update datatable with adapter.update()
-
i fill a datatable with dataadapter and bind it to an bindingsource one of my function return max(id) from above datatable:
datarow[] rows = ds.tables[0].select("id=max(id)");
also datatble has updated whenever needed by:datable dt=ds.tables[0].getchanges(); adapter.update(dt); ds.acceptchanges();
my function (select last id) work correctly for first update, but it dosn't work after add one new record, and return same record. why? :confused: -
i fill a datatable with dataadapter and bind it to an bindingsource one of my function return max(id) from above datatable:
datarow[] rows = ds.tables[0].select("id=max(id)");
also datatble has updated whenever needed by:datable dt=ds.tables[0].getchanges(); adapter.update(dt); ds.acceptchanges();
my function (select last id) work correctly for first update, but it dosn't work after add one new record, and return same record. why? :confused: -
Try to update the dataset instead of the datatable, and avoind performing dataset acceptchanges. If your Datatable is bound to the control, once you update the adapter, may be the call the binding again. Ofcourse your best friend is debugging.