Controlling which Added DataRows get added on a call to Update

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

DataAdapter.Update takes as a param a DataTable. Our DataTable has 4 Added
DataRows. I only want to truly do an insert on the first Added DataRow,
then, come back, do some massaging, then do an insert on the 2nd Added
DataRow, etc. How can I control this?
 
Yeah, I thought of that, like OnRowUpdating. Was hoping there was a simple
'try this' out there without having to handle the event.
 
2nd issue with handling the event is our data tier logic is very generic.
It simply takes a datatable. I do not want to introduce code in the data
tier logic that looks at a particular datatable by name and handles the
update accordingly.
 
Greg,

You could create an array of DataRow objects, ordered based
on how you want to submit the new rows, and use that array when
calling DataAdapter.Update. If the order could be based on the
sort order of a column (or set of columns), you could create the
array of DataRow objects by calling DataTable.Select, supplying
the appropriate criteria and sort order.

I hope this information proves helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2003 Microsoft Corporation. All rights reserved.
 
Back
Top