This is quite dependant of the exact objects you use. As example, you can
replace the automatically generated DataSet.UpdateCommand Command (see Chap.
10 of "Microsoft ADO.Net", by David Sceppa, at Microsoft Press, and probably
at MSDN too); at another level, you can also try using an "archive" method
which simply loops over the rows, checking the rowState:
foreach( MyKindOfRow r in myDataTable.Rows)
{
switch (r.RowState)
{
case System.Data.DataRowState.Added:
...
myTableAdapter.Update( r) ; // add the record
...
break;
case System.Data.DataRowState.Deleted:
...
myTableAdapter.Update( r) ; // delete the record
...
break;
case System.Data.DataRowState.Modified:
case System.Data.DataRowState.Unchanged:
case System.Data.DataRowState.Detached:
// do nothing
break;
default:
throw new Exception("Unexpected RowState value.");
}
}
but observe that your row will still be in a state of being 'modified', so
don't blindly Update the row explicitly (or implicitly) somewhere else, the
effect would be that the modified row would then be updated.
Vanderghast, Access MVP
Look it up in a textbook. An INSERT is just that. An UPDATE is just
that. One is for new records and the other is for existing records.
C'mon, do some work. You're wasting more time here than you could
solving the problem.
RL
You're killing me Ray. If you don't understand the question that I'm
asking then don't respond. Trust me, I understand the difference
between an INSERT and an UPDATE. What I don't understand is how to
get this particular .NET Framework object to use them the way I want.
I have read the documentation and it does not clear things up. I have
googled high and low and not found the answer. I use these groups as
a last resort to answer questions that I can't seem to dig up
elsewhere.