OleDbCommandBuilder Class
Automatically generates single-table commands that are used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
System::MarshalByRefObject
System.ComponentModel::Component
System.Data.Common::DbCommandBuilder
System.Data.OleDb::OleDbCommandBuilder
Assembly: System.Data (in System.Data.dll)
The OleDbCommandBuilder type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | OleDbCommandBuilder() | Initializes a new instance of the OleDbCommandBuilder class. |
![]() | OleDbCommandBuilder(OleDbDataAdapter) | Initializes a new instance of the OleDbCommandBuilder class with the associated OleDbDataAdapter object. |
| Name | Description | |
|---|---|---|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | CatalogLocation | Sets or gets the CatalogLocation for an instance of the DbCommandBuilder class. (Inherited from DbCommandBuilder.) |
![]() | CatalogSeparator | Sets or gets a string used as the catalog separator for an instance of the DbCommandBuilder class. (Inherited from DbCommandBuilder.) |
![]() | ConflictOption | Specifies which ConflictOption is to be used by the DbCommandBuilder. (Inherited from DbCommandBuilder.) |
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | DataAdapter | Gets or sets an OleDbDataAdapter object for which SQL statements are automatically generated. |
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | QuotePrefix | Gets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens. (Inherited from DbCommandBuilder.) |
![]() | QuoteSuffix | Gets or sets the ending character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens. (Inherited from DbCommandBuilder.) |
![]() | SchemaSeparator | Gets or sets the character to be used for the separator between the schema identifier and any other identifiers. (Inherited from DbCommandBuilder.) |
![]() | SetAllValues | Specifies whether all column values in an update statement are included or only changed ones. (Inherited from DbCommandBuilder.) |
![]() | Site | Gets or sets the ISite of the Component. (Inherited from Component.) |
| Name | Description | |
|---|---|---|
![]() | ApplyParameterInfo | Allows the provider implementation of the DbCommandBuilder class to handle additional parameter properties. (Inherited from DbCommandBuilder.) |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() ![]() | DeriveParameters | Retrieves parameter information from the stored procedure specified in the OleDbCommand and populates the Parameters collection of the specified OleDbCommand object. |
![]() | Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the DbCommandBuilder and optionally releases the managed resources. (Inherited from DbCommandBuilder.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | GetDeleteCommand() | Gets the automatically generated OleDbCommand object required to perform deletions at the data source. |
![]() | GetDeleteCommand(Boolean) | Gets the automatically generated OleDbCommand object required to perform deletions at the data source. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetInsertCommand() | Gets the automatically generated OleDbCommand object required to perform insertions at the data source. |
![]() | GetInsertCommand(Boolean) | Gets the automatically generated OleDbCommand object required to perform insertions at the data source. |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetParameterName(Int32) | Returns the name of the specified parameter in the format of @p#. Use when building a custom command builder. (Inherited from DbCommandBuilder.) |
![]() | GetParameterName(String) | Infrastructure. Returns the full parameter name, given the partial parameter name. (Inherited from DbCommandBuilder.) |
![]() | GetParameterPlaceholder | Infrastructure. Returns the placeholder for the parameter in the associated SQL statement. (Inherited from DbCommandBuilder.) |
![]() | GetSchemaTable | Returns the schema table for the DbCommandBuilder. (Inherited from DbCommandBuilder.) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetUpdateCommand() | Gets the automatically generated OleDbCommand object required to perform updates at the data source. |
![]() | GetUpdateCommand(Boolean) | Gets the automatically generated OleDbCommand object required to perform updates at the data source, optionally using columns for parameter names. |
![]() | InitializeCommand | Resets the CommandTimeout, Transaction, CommandType, and UpdateRowSource properties on the DbCommand. (Inherited from DbCommandBuilder.) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | QuoteIdentifier(String) | Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier. This includes correctly escaping any embedded quotes in the identifier. (Overrides DbCommandBuilder::QuoteIdentifier(String).) |
![]() | QuoteIdentifier(String, OleDbConnection) | Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier. This includes correctly escaping any embedded quotes in the identifier. |
![]() | RefreshSchema | Clears the commands associated with this DbCommandBuilder. (Inherited from DbCommandBuilder.) |
![]() | RowUpdatingHandler | Adds an event handler for the RowUpdating event. (Inherited from DbCommandBuilder.) |
![]() | SetRowUpdatingHandler | Registers the DbCommandBuilder to handle the RowUpdating event for a DbDataAdapter. (Inherited from DbCommandBuilder.) |
![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.) |
![]() | UnquoteIdentifier(String) | Given a quoted identifier, returns the correct unquoted form of that identifier. This includes correctly un-escaping any embedded quotes in the identifier. (Overrides DbCommandBuilder::UnquoteIdentifier(String).) |
![]() | UnquoteIdentifier(String, OleDbConnection) | Given a quoted identifier, returns the correct unquoted form of that identifier. This includes correctly un-escaping any embedded quotes in the identifier. |
The OleDbDataAdapter does not automatically generate the SQL statements required to reconcile changes made to a DataSet with the associated data source. However, you can create an OleDbCommandBuilder object to automatically generate SQL statements for single-table updates if you set the SelectCommand property of the OleDbDataAdapter. Then, any additional SQL statements that you do not set are generated by the OleDbCommandBuilder.
The OleDbCommandBuilder registers itself as a listener for RowUpdating events whenever you set the DataAdapter property. You can only associate one OleDbDataAdapter or OleDbCommandBuilder object with each other at one time.
To generate INSERT, UPDATE, or DELETE statements, the OleDbCommandBuilder uses the SelectCommand property to retrieve a required set of metadata automatically. If you change the SelectCommand after the metadata is retrieved, such as after the first update, you should call the RefreshSchema method to update the metadata.
The OleDbCommandBuilder also uses the Connection, CommandTimeout, and Transaction properties referenced by the SelectCommand. The user should call RefreshSchema if one or more 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 OleDbCommandBuilder is disassociated from the OleDbDataAdapter, and the generated commands are no longer used.
The following example uses the OleDbCommand, along OleDbDataAdapter and OleDbConnection, to select rows from a data source. The example is passed an initialized DataSet, a connection string, a query string that is an SQL SELECT statement, and a string that is the name of the data source table. The example then creates an OleDbCommandBuilder.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
