Controlling which Added DataRows get added on a call to Update

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?
 
G

Greg

Yeah, I thought of that, like OnRowUpdating. Was hoping there was a simple
'try this' out there without having to handle the event.
 
G

Greg

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.
 
D

David Sceppa

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top