|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Binding to TextBoxes on MySQL with 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! 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! |
|||||||||||||||||||||||