O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

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

Generating SqlCommand Objects with the SqlCeCommandBuilder

Looking back at Listing 7.11, you can see that several lines of code are required to set up the update, insert, and delete commands of the SqlCeDataAdapter. The SqlCeCommandBuilder can do this work for you, but the SqlCeDataAdapter must be handling a single source table.

First, you need to initialize the SqlCeDataAdapter and its SelectCommand property. You then create SqlCeCommandBuilder that passes the SqlCeDataAdapter as a parameter to the SqlCeCommandBuilder constructor. The SqlCeCommandBuilder will then create a command for SqlCeDataAdapter's UpdateCommand, InsertCommand, and DeleteCommand properties. Listing 7.14 demonstrates how to use the SqlCeCommandBuilder to build a SqlCeDataAdapter ...

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