OracleCommandBuilder Class
Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
Assembly: System.Data.OracleClient (in System.Data.OracleClient.dll)
System::MarshalByRefObject
System.ComponentModel::Component
System.Data.Common::DbCommandBuilder
System.Data.OracleClient::OracleCommandBuilder
| Name | Description | |
|---|---|---|
![]() | OracleCommandBuilder() | Initializes a new instance of the OracleCommandBuilder. |
![]() | OracleCommandBuilder(OracleDataAdapter^) | Initializes a new instance of the OracleCommandBuilder class with the associated OracleDataAdapter object. |
| Name | Description | |
|---|---|---|
![]() | CatalogLocation | Sets or gets the CatalogLocation for an instance of the DbCommandBuilder class.(Overrides DbCommandBuilder::CatalogLocation.) |
![]() | CatalogSeparator | Sets or gets a string used as the catalog separator for an instance of the DbCommandBuilder class.(Overrides DbCommandBuilder::CatalogSeparator.) |
![]() | 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 OracleDataAdapter object for which this OracleCommandBuilder object will generate SQL statements. |
![]() | 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.(Overrides DbCommandBuilder::SchemaSeparator.) |
![]() | SetAllValues | Specifies whether all column values in an update statement are included or only changed ones.(Inherited from DbCommandBuilder.) |
![]() | Site |
| Name | Description | |
|---|---|---|
![]() | CreateObjRef(Type^) | 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(OracleCommand^) | Retrieves parameter information from the stored procedure specified in the OracleCommand and populates the Parameters collection of the specified OracleCommand object. |
![]() | Dispose() | |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetDeleteCommand() | Gets the automatically generated OracleCommand object required to perform deletions on the database. |
![]() | GetDeleteCommand(Boolean) | Gets the automatically generated OracleCommand object required to perform deletions on the database. |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetInsertCommand() | Gets the automatically generated OracleCommand object required to perform insertions on the database. |
![]() | GetInsertCommand(Boolean) | Gets the automatically generated OracleCommand object required to perform insertions on the database. |
![]() | GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | GetType() | |
![]() | GetUpdateCommand() | Gets the automatically generated OracleCommand object required to perform updates on the database. |
![]() | GetUpdateCommand(Boolean) | Gets the automatically generated OracleCommand object required to perform updates on the database. |
![]() | InitializeLifetimeService() | Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | QuoteIdentifier(String^) | Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier.(Overrides DbCommandBuilder::QuoteIdentifier(String^).) |
![]() | RefreshSchema() | Clears the commands associated with this DbCommandBuilder.(Inherited from DbCommandBuilder.) |
![]() | ToString() | |
![]() | UnquoteIdentifier(String^) | Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier.(Overrides DbCommandBuilder::UnquoteIdentifier(String^).) |
This type is deprecated and will be removed in a future version of the .NET Framework. For more information, see Oracle and ADO.NET.
The OracleDataAdapter does not automatically generate the SQL statements required to reconcile changes made to a DataSet associated with the database. However, you can create an OracleCommandBuilder object that generates SQL statements for single-table updates by setting the SelectCommand property of the OracleDataAdapter. Then, the OracleCommandBuilder generates any additional SQL statements that you do not set.
The relationship between an OracleDataAdapter and its corresponding OracleCommandBuilder is always one-to-one. To create this correspondence, you set the OracleDataAdapter property of the OracleCommandBuilder object. This causes the OracleCommandBuilder to register itself as a listener, which produces the output of RowUpdating events that affect the DataSet.
To generate INSERT, UPDATE, or DELETE statements, the OracleCommandBuilder uses the SelectCommand property to retrieve a required set of metadata.
The OracleCommandBuilder also uses the Connection, and Transaction properties referenced by the SelectCommand.
If you call Dispose, the OracleCommandBuilder is disassociated from the OracleDataAdapter, and the generated commands are no longer used.
The following example uses OracleCommand, along with OracleDataAdapter and OracleConnection, to select rows from a database. 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 database table. The example then creates an OracleCommandBuilder.
[Visual Basic]
Private Function SelectOracleRows(connection As String, queryString As String, tableName As String) As DataSet
Dim connection As New OracleConnection(connection)
Dim dataAdapter As New OracleDataAdapter()
Dim dataSet As DataSet = New DataSet
dataAdapter.SelectCommand = New OracleCommand(queryString, connection)
Dim cmdBuilder As OracleCommandBuilder = New OracleCommandBuilder(dataAdapter)
connection.Open()
dataAdapter.Fill(dataSet, tableName)
' Code to modify data in DataSet here
' Without the OracleCommandBuilder this line would fail.
dataAdapter.Update(dataSet, tableName)
connection.Close()
End Function
[C#]
public static DataSet SelectOracleSrvRows(string myConnection, string mySelectQuery, string myTableName)
{
OracleConnection myConn = new OracleConnection(myConnection);
OracleDataAdapter myDataAdapter = new OracleDataAdapter();
myDataAdapter.SelectCommand = new OracleCommand(mySelectQuery, myConn);
OracleCommandBuilder cb = new OracleCommandBuilder(myDataAdapter);
myConn.Open();
DataSet ds = new DataSet();
myDataAdapter.Fill(ds, myTableName);
//Code to modify data in DataSet goes here...
//Without the OracleCommandBuilder this line would fail.
myDataAdapter.Update(ds, myTableName);
myConn.Close();
return ds;
}
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



