dataset getchanges() question
-
GetChanges() returns nothing here, right after a row is deleted. and there is actually 1 row removed from the dataset, how is this possible? dsCustomers.GetChanges() gives the same results.
dsCustomers.Tables(0).Rows.Remove(dsCustomers.Tables(0).Rows(cm.Position)) Dim DataSetDeleted As DataSet = dsCustomers.GetChanges(DataRowState.Deleted) If Not DataSetDeleted Is Nothing Then daCustomers.Update(DataSetDeleted) dsCustomers.AcceptChanges() End If
-
GetChanges() returns nothing here, right after a row is deleted. and there is actually 1 row removed from the dataset, how is this possible? dsCustomers.GetChanges() gives the same results.
dsCustomers.Tables(0).Rows.Remove(dsCustomers.Tables(0).Rows(cm.Position)) Dim DataSetDeleted As DataSet = dsCustomers.GetChanges(DataRowState.Deleted) If Not DataSetDeleted Is Nothing Then daCustomers.Update(DataSetDeleted) dsCustomers.AcceptChanges() End If
From what i understand you need to call the delete method of the datarow. Calling the remove method removes the row entirely (it is gone and the rowcount is reduced). When you call the getchanges method with the deleted parameter it looks for rows marked as deleted. as you have used remove there are no rows that fit this description. If you call the delete method it simply marks the row as deleted. GetChanges with then report that row as deleted and you can call an update. Jonathan
-
From what i understand you need to call the delete method of the datarow. Calling the remove method removes the row entirely (it is gone and the rowcount is reduced). When you call the getchanges method with the deleted parameter it looks for rows marked as deleted. as you have used remove there are no rows that fit this description. If you call the delete method it simply marks the row as deleted. GetChanges with then report that row as deleted and you can call an update. Jonathan