The statement above instructs Command Builder to use the specified Data Adapter.
It then reads associated statements; infers insert, update, and delete commands; and assigns new commands to insert, update, and delete properties of the Data Adapter.
create the connection and data adapter as with custom update logic // use a command builder to define updating logic Sql Command Builder cb = new Sql Command Builder(da); // generate updating logic for command objects cb. Fill(ds, "Orders"); // start the transaction Sql Transaction tran = conn.
The data adapter fills a Data Set object when reading the data and writes in a single batch when persisting changes back to the database.
It is the Sql Data Adapter that manages connections with the data source and gives us disconnected behavior.
The Sql Data Adapter opens a connection only when required and closes it as soon as it has performed its task.
Close() But if the Sql Data Adapter object is used to insert/update/delete records in the data source, is it ALWAYS necessary to first make the necessary changes in the Data Set for the data source to reflect the changes? The code I have shown in my first post (which doesn't use Sql Data Adapter) inserts a row in the data source....correct? If you want to update your Data Source without that line you have commnted then try to fill again your Data Set with the Updated values from the Data Base...
Select Command = sql Cmd d Set = New Data Set sql Dapter. If the question is: Why is it needed to specify the values twice (when the new Data Row is created and also when the parameters are defined): First, while adding a new Data Row: d Row(1) = "" Then the answer is "No, you don't need to indicate this twice".