Re: SqlDataAdapter Questions



Hello Aaron,
The DUI commands are to do exactly what they say they do.... Insert... Delete and Update. They are used by the Adaptor to perform those actions when the Update method is called. Typically you use the CommandBuilder to build the proper commands to insert into the DUI Commands. OR, like you said to override the default values.... IE, if only some of the fields are to be updated.

In a nutshell, they are the commands that the adaptor will use when saving (or deleting) the data to the database.


-Chris Anderson [MVP-VB]

Hello,

The SqlDataAdapter has 4 properties of type SqlCommand, SelectCommand,
UpdateCommand, DeleteCommand, and InsertCommand. Setting the
SelectCommand allows the SqlDataAdapter to retrieve data from the
database using the fill method. Aside from that, I don't see much of
a difference. The SelectCommand can be used to insert, update, and
delete all by using the ExecuteNonQuery method. So UpdateCommand,
DeleteCommand, and InsertCommand seem to be somewhat redundant.

The SqlDataAdapter Update method is supposed to, relative to the data
obtained from the Fill method, writeback any changes to the database.
The documentation for UpdateCommand, etc is vague but seems to
indicate that the developer can use UpdateCommand, etc to override or
supplement the auto generated commands when Update is executed (????).

What is the function of these commands?

Thanks,
Aaron


.



Relevant Pages