how does dataadapter determine insert vs update?

  • Thread starter Thread starter Scott Emick
  • Start date Start date
S

Scott Emick

I am trying to figure out what the internal mechanism is where a
dataadapter's update method tells whether to execute the updatecommand vs
the insertcommand. I have a datatable that has a new row in it that I've
created and when I do the update on it, it is trying to shoot out a sql
update command instead of an insert. (I can tell by the SQL Profiler).

Any help appreciated.
 
Thanks I will check that out

Scott

Miha Markic said:
Hi Scott,

It depends on the DataRow.RowState.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Scott Emick said:
I am trying to figure out what the internal mechanism is where a
dataadapter's update method tells whether to execute the updatecommand vs
the insertcommand. I have a datatable that has a new row in it that I've
created and when I do the update on it, it is trying to shoot out a sql
update command instead of an insert. (I can tell by the SQL Profiler).

Any help appreciated.

--
Scott Emick
Web Programmer
Fox International
Remove the ham from mail address if it's not spam
 
The Update method scans the Rows collection looking at the RowState. This
indicates "added", "changed", etc. rows. How were the DataAdapter action
Commands created? Did you wire them up or get the wizards to do it? What is
the RowState of the newly added row?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top