Home All Groups Group Topic Archive Search About

Binding to TextBoxes on MySQL with C#

Author
2 Mar 2006 10:48 PM
jwitt
Ref: WinXP SP2, MySQL 5.0, .NET 1.1, C#

I try to bind columns to TextBoxes. The column data appears in the
textboxes, but if modified will not update. My code came from MySQL
example, which uses a datagrid. If cols in the datagrid are modified
they update fine.

The following code:

   DataTable changes;


   changes = this.data.GetChanges();
   x = 1;
   this.da.Update( changes );
   this.data.AcceptChanges();

yields the error "Value cannot be null", as I guess 'changes' is null
because nothing in the DataGrid has changed.

So, how to get the TextBox bindings to yield non-null 'changes'

FYI: 'data' is a DataTable, 'da' is MySQLDataAdapter

Thanks!

Author
3 Mar 2006 7:48 AM
Cor Ligthert [MVP]
jwitt,

Mostly will help you to do a endcurrentedit in version 1.x (AFAIK does
EndEdit now the same in 2.0) to push the data down in the datasource, what
is standard only done by a rowchange.

typed here so watch typos or whatever

Therefore before your update
\\\
Bindingcontext[this.data].EndCurrentEdit();
///

I hope this helps,

Cor

Show quote
"jwitt" <baytech***@yahoo.com> schreef in bericht
news:%23Ca%23otkPGHA.428@tk2msftngp13.phx.gbl...
> Ref: WinXP SP2, MySQL 5.0, .NET 1.1, C#
>
> I try to bind columns to TextBoxes. The column data appears in the
> textboxes, but if modified will not update. My code came from MySQL
> example, which uses a datagrid. If cols in the datagrid are modified they
> update fine.
>
> The following code:
>
>   DataTable changes;
>
>
>   changes = this.data.GetChanges();
>   x = 1;
>   this.da.Update( changes );
>   this.data.AcceptChanges();
>
> yields the error "Value cannot be null", as I guess 'changes' is null
> because nothing in the DataGrid has changed.
>
> So, how to get the TextBox bindings to yield non-null 'changes'
>
> FYI: 'data' is a DataTable, 'da' is MySQLDataAdapter
>
> Thanks!

AddThis Social Bookmark Button