Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
Assembly: System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)
Thetype exposes the following members.
|CanRaiseEvents||(inherited from Component)|
|CatalogLocation||Not supported in SQL Server Compact. (Overrides DbCommandBuilder.CatalogLocation.)|
|CatalogSeparator||Not supported in SQL Server Compact. (Overrides DbCommandBuilder.CatalogSeparator.)|
|ConflictOption||Specifies which ConflictOption is to be used by the . (Overrides DbCommandBuilder.ConflictOption.)|
|Container||(inherited from Component)|
|DataAdapter||Gets or sets a SqlCeDataAdapter object for which SQL statements are automatically generated.|
|DesignMode||(inherited from Component)|
|Events||(inherited from Component)|
|QuotePrefix||Gets or sets the beginning character or characters to use when specifying SQL Server database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens. (Overrides DbCommandBuilder.QuotePrefix.)|
|QuoteSuffix||Gets or sets the ending character or characters to use when specifying SQL Server database objects (for example, tables or columns) whose names contain characters, such as spaces or reserved tokens. (Overrides DbCommandBuilder.QuoteSuffix.)|
|SchemaSeparator||Not supported in SQL Server Compact. (Overrides DbCommandBuilder.SchemaSeparator.)|
|SetAllValues||(inherited from DbCommandBuilder)|
|Site||(inherited from Component)|
You can create a object to automatically generate Transact-SQL statements for single-table updates if you set the SelectCommand property.
To generate INSERT, UPDATE, or DELETE statements, the uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata is retrieved (for example, after the first update), you should call the method to update the metadata.
The SelectCommand must also return at least one primary key or unique column. If none are present, an InvalidOperation exception is generated, and the commands are not generated.
The also uses the Connection and Transaction properties referenced by the SelectCommand. You should call 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 , the is disassociated from the SqlCeDataAdapter, and the generated commands are no longer used.
The following example uses the SqlCeCommand, along with SqlCeDataAdapter and SqlCeConnection, to select rows from a data source. The example is passed a connection string, a query string, and a string that is the name of the database table. The example then creates a . That command builder is then used by the data adapter to update the modified DataSet in the local database.