bobbynad Posted June 29, 2003 Posted June 29, 2003 dim Dr as datarow Dim Dt As DataTable = dg1.datasoursse Dim Hit As DataGrid.HitTestInfo Hit = DG1.HitTest(e.X, e.Y) Dr = Dt.Rows(Hit.Row) Dr.BeginEdit() Dr("fieldname") = "xyx" Dim Ds_temp As DataSet = Ds1.GetChanges(DataRowState.Modified) ' Ds1 is the main Dataset attached to the Datagrid DG1 Adp1.Update(Ds_temp) Dr.AcceptChanges() In the above code , I am modifing a field but , the dataset says that neither of the field is changed or modified , hence I get the problem in the next line when updating DATAADAPTER Adp1. Where am I wrong Quote
*Experts* jfackler Posted June 29, 2003 *Experts* Posted June 29, 2003 Your working to hard. Since the datagrid is bound to the ds1 (I assume it is your datasource...if not, we have other issues), any edit of the datagrid will be persisted to the dataset. The rowstate will be set to modified and all you have to do is run an .update on the adapter. You may have to include a Me.BindingContext(DataSet, "TableName").EndCurrentEdit() or, in c#, this.BindingContext[DataSet,"TableName"].EndCurrentEdit() before your DataAdapter.update call. Jon Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.