Sqldataadapter rowupdating

Rated 4.19/5 based on 512 customer reviews

Finally, we set the Update Batch Size property of the Sql Data Adapter to 10 indicating that we want to update 10 rows as a batch.

If you run this application you will notice that the variable updating holds the value equal to the number of rows in the table because this event is raised each time a row is being updated.

When you use Sql Data Adapter for performing updates, the Sql Data Adapter propagates the updates one by one.

That means if there are 100 rows to be updated the Sql Data Adapter will execute 100 separate operations against the database.

On the other hand the variable update will hold value equal to (number of rows in the table) / (batch size). NET 2.0, the Data Adapter provides a property called Update Batch Size which allows you to execute queries in a batch.

This significantly reduces the database roundtrips and hence is more efficient in terms of performance. He is a published author and has authored or co-authored books for Apress and Wrox press.

Fill Error = new Fill Error Event Handler(da_Fill Error); Data Set ds = new Data Set(); da.

sqldataadapter rowupdating-70

sqldataadapter rowupdating-62

sqldataadapter rowupdating-84

call a method in the beginning before using this adapter (say in main form after you create instance of it).

There are also two events associated with this that you can use � Row Updating and Row Updated. in the absence of batch update, both of these events are raised for each and every row being updated.

For example, if we are updating 100 rows, both of these rows are raised for 100 times.

Following code illustrates use of this feature: Notice how we have attached event handlers to the Row Updating and Row Updated events.

These event handlers simply increment two integer variables.

Leave a Reply