SqlCeCommandBuilder Class

SqlCeCommandBuilder Class

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated SQL Server CE database. This class cannot be inherited.

For a list of all members of this type, see SqlCeCommandBuilder Members.


[Visual Basic]
NotInheritable Public Class SqlCeCommandBuilder
   Inherits Component
public sealed class SqlCeCommandBuilder : Component
public __gc __sealed class SqlCeCommandBuilder : public Component
public class SqlCeCommandBuilder extends Component

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


SqlCeCommandBuilder creates SQL statements that do not detect conflicts. This behavior differs from that of System.Data.SqlClient.

The SqlCeCommandBuilder registers itself as a listener for RowUpdating events whenever you set the DataAdapter property. You can associate only one SqlCeDataAdapter or SqlCeCommandBuilder object with each other at one time.

To generate INSERT, UPDATE, or DELETE statements, the SqlCeCommandBuilder uses the SelectCommand property to retrieve a required set of meta data automatically. If you change the SelectCommand after the meta data has been retrieved (for example, after the first update), you should call the RefreshSchema method to update the meta data.

The SelectCommand must also return at least one primary key or unique column. If there is none present, an InvalidOperation exception is generated, and the commands are not generated.

The SqlCeCommandBuilder also uses the Connection and Transaction properties referenced by the SelectCommand. You should call RefreshSchema if any of these properties are modified, or if the SelectCommand itself is replaced. Otherwise, the InsertCommand, UpdateCommand, and DeleteCommand properties retain their previous values.

If you call Dispose, the SqlCeCommandBuilder is disassociated from the SqlCeDataAdapter, and the generated commands are no longer used.


Namespace: System.Data.SqlServerCe

Platforms: .NET Compact Framework

Assembly: System.Data.Sqlserverce (in System.Data.Sqlserverce.dll)

See Also

SqlCeCommandBuilder Members | System.Data.SqlServerCe Namespace

© 2015 Microsoft