O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Optimize DataAdapter Performance with a Timestamp

Problem

You want to use strict concurrency checking but optimize DataAdapter performance.

Solution

Add a timestamp field to your table, and create a custom update command that uses it.

Discussion

You can use the CommandBuilder to generate update logic for your database tables. However, the autogenerated SQL statements it creates are usually inefficient because they attempt to match every field in a table. As the number of columns increases in the DataTable, the number of columns in the WHERE clause of the query also increases.

To improve on this system, you can add a special timestamp field to your table. Most database systems support some kind of timestamp data type, which the data source updates automatically ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required