O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

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

Using a SqlCommandBuilder to Generate Updating Logic

The ADO.NET object model not only allows you to define your own updating logic, but it also provides dynamic updating logic generation similar to that of the ADO cursor engine, using the SqlCommandBuilder class. If you instantiate a SqlCommandBuilder object and associate it with a SqlDataAdapter object, the SqlCommandBuilder will attempt to generate updating logic based on the query contained in the SqlDataAdapter object’s SelectCommand.

To demonstrate how the SqlCommandBuilder works, I’ll use it to generate updating logic for our sample code that queries the Order Details table. The following code snippet instantiates a SqlCommandBuilder, supplying a SqlDataAdapter in the constructor. It then ...

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