OracleCommandBuilder 类

定义

警告

此 API 现已过时。

自动生成用于协调 DataSet 的更改与关联数据库的单表命令。Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated database. 无法继承此类。This class cannot be inherited.

public ref class OracleCommandBuilder sealed : System::Data::Common::DbCommandBuilder
public sealed class OracleCommandBuilder : System.Data.Common.DbCommandBuilder
[System.Obsolete("OracleCommandBuilder has been deprecated. http://go.microsoft.com/fwlink/?LinkID=144260", false)]
public sealed class OracleCommandBuilder : System.Data.Common.DbCommandBuilder
type OracleCommandBuilder = class
    inherit DbCommandBuilder
Public NotInheritable Class OracleCommandBuilder
Inherits DbCommandBuilder
继承
继承
OracleCommandBuilder
属性

示例

下面的示例使用 OracleCommand,以及 OracleDataAdapterOracleConnection从数据库中选择行。The following example uses OracleCommand, along with OracleDataAdapter and OracleConnection, to select rows from a database. 该示例传递了初始化的 DataSet、连接字符串、属于 SQL SELECT 语句的查询字符串以及作为数据库表名称的字符串。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. 然后,该示例创建一个 OracleCommandBuilderThe example then creates an OracleCommandBuilder.

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  
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;  
}  

注解

此类型已弃用,并将在 .NET Framework 的未来版本中删除。This type is deprecated and will be removed in a future version of the .NET Framework. 有关详细信息,请参阅Oracle 和 ADO.NETFor more information, see Oracle and ADO.NET.

OracleDataAdapter 不会自动生成协调对与数据库关联的 DataSet 所做的更改所需的 SQL 语句。The OracleDataAdapter does not automatically generate the SQL statements required to reconcile changes made to a DataSet associated with the database. 但是,您可以通过设置 OracleDataAdapterSelectCommand 属性,创建一个为单表更新生成 SQL 语句的 OracleCommandBuilder 对象。However, you can create an OracleCommandBuilder object that generates SQL statements for single-table updates by setting the SelectCommand property of the OracleDataAdapter. 然后,OracleCommandBuilder 会生成未设置的任何其他 SQL 语句。Then, the OracleCommandBuilder generates any additional SQL statements that you do not set.

OracleDataAdapter 与其对应的 OracleCommandBuilder 之间的关系始终为一对一关系。The relationship between an OracleDataAdapter and its corresponding OracleCommandBuilder is always one-to-one. 若要创建此函件,请设置 OracleCommandBuilder 对象的 OracleDataAdapter 属性。To create this correspondence, you set the OracleDataAdapter property of the OracleCommandBuilder object. 这会导致 OracleCommandBuilder 将自身注册为侦听器,这会生成影响 DataSetRowUpdating 事件的输出。This causes the OracleCommandBuilder to register itself as a listener, which produces the output of RowUpdating events that affect the DataSet.

若要生成 INSERT、UPDATE 或 DELETE 语句,OracleCommandBuilder 使用 SelectCommand 属性来检索所需的一组元数据。To generate INSERT, UPDATE, or DELETE statements, the OracleCommandBuilder uses the SelectCommand property to retrieve a required set of metadata.

OracleCommandBuilder 还使用 SelectCommand所引用的 ConnectionTransaction 属性。The OracleCommandBuilder also uses the Connection, and Transaction properties referenced by the SelectCommand.

如果调用 Dispose,则 OracleCommandBuilder 会与 OracleDataAdapter解除关联,不再使用生成的命令。If you call Dispose, the OracleCommandBuilder is disassociated from the OracleDataAdapter, and the generated commands are no longer used.

构造函数

OracleCommandBuilder()

初始化 OracleCommandBuilder 的新实例。Initializes a new instance of the OracleCommandBuilder.

OracleCommandBuilder(OracleDataAdapter)

使用关联的 OracleCommandBuilder 对象初始化 OracleDataAdapter 类的新实例。Initializes a new instance of the OracleCommandBuilder class with the associated OracleDataAdapter object.

属性

CanRaiseEvents

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

(继承自 Component)
CatalogLocation

获取或设置 CatalogLocation 类的实例的 DbCommandBuilderGets or sets the CatalogLocation for an instance of the DbCommandBuilder class.

CatalogSeparator

获取或设置一个字符串,该字符串用作 DbCommandBuilder 类的实例的目录分隔符。Gets or sets a string used as the catalog separator for an instance of the DbCommandBuilder class.

ConflictOption

指定哪个 ConflictOption 将由 DbCommandBuilder 使用。Specifies which ConflictOption is to be used by the DbCommandBuilder.

(继承自 DbCommandBuilder)
Container

获取 IContainer,它包含 ComponentGets the IContainer that contains the Component.

(继承自 Component)
DataAdapter

获取或设置此 OracleDataAdapter 对象将为其生成 SQL 语句的 OracleCommandBuilder 对象。Gets or sets an OracleDataAdapter object for which this OracleCommandBuilder object will generate SQL statements.

DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(继承自 Component)
Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(继承自 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.

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.

SchemaSeparator

获取或设置要用作架构标识符和任何其他标识符之间的分隔符的字符。Gets or sets the character to be used for the separator between the schema identifier and any other identifiers.

SetAllValues

指定 update 语句中是包含所有列值还是仅包含更改的列值。Specifies whether all column values in an update statement are included or only changed ones.

(继承自 DbCommandBuilder)
Site

获取或设置 ISiteComponentGets or sets the ISite of the Component.

(继承自 Component)

方法

ApplyParameterInfo(DbParameter, DataRow, StatementType, Boolean)

允许 DbCommandBuilder 类的提供程序实现处理附加参数属性。Allows the provider implementation of the DbCommandBuilder class to handle additional parameter properties.

(继承自 DbCommandBuilder)
CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
DeriveParameters(OracleCommand)

从在 OracleCommand 中指定的存储过程中检索参数信息并填充指定的 Parameters 对象的 OracleCommand 集合。Retrieves parameter information from the stored procedure specified in the OracleCommand and populates the Parameters collection of the specified OracleCommand object.

Dispose()

释放 Component 使用的所有资源。Releases all resources used by the Component.

(继承自 Component)
Dispose(Boolean)

释放 Component 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(继承自 Component)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetDeleteCommand()

获取自动生成的、对数据库执行删除操作所需的 OracleCommand 对象。Gets the automatically generated OracleCommand object required to perform deletions on the database.

GetDeleteCommand(Boolean)

获取自动生成的、对数据库执行删除操作所需的 OracleCommand 对象。Gets the automatically generated OracleCommand object required to perform deletions on the database.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetInsertCommand()

获取自动生成的、对数据库执行插入操作所需的 OracleCommand 对象。Gets the automatically generated OracleCommand object required to perform insertions on the database.

GetInsertCommand(Boolean)

获取自动生成的、对数据库执行插入操作所需的 OracleCommand 对象。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.

(继承自 MarshalByRefObject)
GetParameterName(Int32)

@p# 格式返回指定参数的名称。Returns the name of the specified parameter in the format of @p#. 在生成自定义命令生成器时使用。Use when building a custom command builder.

(继承自 DbCommandBuilder)
GetParameterName(String)

给定部分参数名,返回完整参数名。Returns the full parameter name, given the partial parameter name.

(继承自 DbCommandBuilder)
GetParameterPlaceholder(Int32)

返回该参数在关联的 SQL 语句中的占位符。Returns the placeholder for the parameter in the associated SQL statement.

(继承自 DbCommandBuilder)
GetSchemaTable(DbCommand)

返回 DbCommandBuilder 的架构表。Returns the schema table for the DbCommandBuilder.

(继承自 DbCommandBuilder)
GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

(继承自 Component)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
GetUpdateCommand()

获取自动生成的、对数据库执行更新操作所需的 OracleCommand 对象。Gets the automatically generated OracleCommand object required to perform updates on the database.

GetUpdateCommand(Boolean)

获取自动生成的、对数据库执行更新操作所需的 OracleCommand 对象。Gets the automatically generated OracleCommand object required to perform updates on the database.

InitializeCommand(DbCommand)

重置 CommandTimeout 上的 TransactionCommandTypeUpdateRowSourceDbCommand 属性。Resets the CommandTimeout, Transaction, CommandType, and UpdateRowSource properties on the DbCommand.

(继承自 DbCommandBuilder)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 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.

RefreshSchema()

清除与此 DbCommandBuilder 关联的命令。Clears the commands that are associated with this DbCommandBuilder.

RowUpdatingHandler(RowUpdatingEventArgs)

添加 RowUpdating 事件的事件处理程序。Adds an event handler for the RowUpdating event.

(继承自 DbCommandBuilder)
SetRowUpdatingHandler(DbDataAdapter)

注册 DbCommandBuilder 以处理 RowUpdatingDbDataAdapter 事件。Registers the DbCommandBuilder to handle the RowUpdating event for a DbDataAdapter.

(继承自 DbCommandBuilder)
ToString()

返回包含 String 的名称的 Component(如果有)。Returns a String containing the name of the Component, if any. 不应重写此方法。This method should not be overridden.

(继承自 Component)
UnquoteIdentifier(String)

给定一个带引号的标识符,返回该标识符的不带引号的正确形式,包括正确地取消转义该标识符中嵌入的任何引号。Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier.

事件

Disposed

当通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(继承自 Component)

适用于

另请参阅