OracleParameterCollection OracleParameterCollection OracleParameterCollection OracleParameterCollection Class

定义

表示与 OracleCommand 相关的参数的集合以及它们各自到 DataSet 中列的映射。Represents a collection of parameters relevant to an OracleCommand as well as their respective mappings to columns in a DataSet. 此类不能被继承。This class cannot be inherited.

public ref class OracleParameterCollection sealed : System::Data::Common::DbParameterCollection
[System.ComponentModel.ListBindable(false)]
public sealed class OracleParameterCollection : System.Data.Common.DbParameterCollection
type OracleParameterCollection = class
    inherit DbParameterCollection
Public NotInheritable Class OracleParameterCollection
Inherits DbParameterCollection
继承
OracleParameterCollectionOracleParameterCollectionOracleParameterCollectionOracleParameterCollection
属性

示例

下面的示例创建的多个实例OracleParameter通过OracleParameterCollectionOracleDataAdapterThe following example creates multiple instances of OracleParameter through the OracleParameterCollection within the OracleDataAdapter. 这些参数用于选择在数据库中的数据,然后在其中放置数据DataSetThese parameters are used to select data within the database and then place the data in the DataSet. 此示例假定DataSet和一个OracleDataAdapter已创建与相应的架构、 命令和连接。This example assumes that a DataSet and an OracleDataAdapter have already been created with the appropriate schema, commands, and connection.

public void AddOracleParameters() 
 {
 // ...
 // create dataSet and adapter
 // ...
   adapter.SelectCommand.Parameters.Add("pEName", OracleType.VarChar, 80).Value = "Smith";
   adapter.SelectCommand.Parameters.Add("pEmpNo", OracleType.Int32).Value = 7369;
   adapter.Fill(dataSet);
 }

Public Sub AddOracleParameters()
    ' ...
    ' create dataSet and adapter
    ' ...
adapter.SelectCommand.Parameters.Add("pEName", OracleType.VarChar, 80).Value = "Smith"
adapter.SelectCommand.Parameters.Add("pEmpNo", OracleType.Int32).Value = 7369
adapter.Fill(dataSet)
End Sub 

注解

当使用命名参数时,集合中的参数数量必须等于命令文本中的命名参数的数量或适用于 Oracle 的.NET Framework 数据提供程序将引发错误。When using named parameters, the number of parameters in the collection must be equal to the number of named parameters within the command text, or the .NET Framework Data Provider for Oracle raises an error.

有关将参数传递给 SQL 语句调用的适用于 Oracle 的.NET Framework 数据提供程序不支持问号 (?) 占位符OracleCommandCommandType.TextThe .NET Framework Data Provider for Oracle does not support the question mark (?) placeholder for passing parameters to an SQL statement called by an OracleCommand of CommandType.Text. 在这种情况下,必须使用命名的参数。In this case, named parameters must be used. 例如:For example:

SELECT * FROM Customers WHERE CustomerID = :pCustomerID  

使用名为 SQL 语句中的参数调用时OracleCommandCommandType.Text,您必须在参数名称前面加冒号 (:)。When using named parameters in an SQL statement called by an OracleCommand of CommandType.Text, you must precede the parameter name with a colon (:). 但是,在存储过程,或一个命名参数在代码中其他位置引用时 (例如,在添加OracleParameter对象添加到Parameters属性),不要在前面加冒号 (:) 的命名的参数。However, in a stored procedure, or when referring to a named parameter elsewhere in your code (for example, when adding OracleParameter objects to the Parameters property), do not precede the named parameter with a colon (:). 数据提供程序将自动提供冒号。The data provider supplies the colon automatically.

构造函数

OracleParameterCollection() OracleParameterCollection() OracleParameterCollection() OracleParameterCollection()

初始化 OracleParameterCollection 类的新实例。Initializes a new instance of the OracleParameterCollection class.

属性

Count Count Count Count

返回一个整数,其中包含 OracleParameterCollection 中的元素的数目。Returns an Integer containing the number of elements in the OracleParameterCollection. 只读。Read-only.

IsFixedSize IsFixedSize IsFixedSize IsFixedSize

获取一个值,该值指示 OracleParameterCollection 是否具有固定大小。Gets a value that indicates whether the OracleParameterCollection has a fixed size.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示 OracleParameterCollection 是否为只读。Gets a value that indicates whether the OracleParameterCollection is read-only.

IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示 OracleParameterCollection 是否已同步。Gets a value that indicates whether the OracleParameterCollection is synchronized.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取或设置指定索引处的 OracleParameterGets or sets the OracleParameter at the specified index.

Item[String] Item[String] Item[String] Item[String]

获取或设置具有指定名称的 OracleParameterGets or sets the OracleParameter with the specified name.

SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步对 OracleParameterCollection 的访问的对象。Gets an object that can be used to synchronize access to the OracleParameterCollection.

方法

Add(Object) Add(Object) Add(Object) Add(Object)

将指定的 OracleParameter 对象添加到 OracleParameterCollection 中。Adds the specified OracleParameter object to the OracleParameterCollection.

Add(OracleParameter) Add(OracleParameter) Add(OracleParameter) Add(OracleParameter)

将指定的 OracleParameter 添加到 OracleParameterCollectionAdds the specified OracleParameter to the OracleParameterCollection.

Add(String, Object) Add(String, Object) Add(String, Object) Add(String, Object)

在给定参数名称和参数值的情况下,将 OracleParameter 添加到 OracleParameterCollection 中。Adds an OracleParameter to the OracleParameterCollection given the parameter name and value.

Add(String, OracleType) Add(String, OracleType) Add(String, OracleType) Add(String, OracleType)

在给定参数名称和数据类型的情况下,将 OracleParameter 添加到 OracleParameterCollection 中。Adds an OracleParameter to the OracleParameterCollection given the parameter name and data type.

Add(String, OracleType, Int32) Add(String, OracleType, Int32) Add(String, OracleType, Int32) Add(String, OracleType, Int32)

在给定参数名称、数据类型和列长的情况下,将 OracleParameter 添加到 OracleParameterCollection 中。Adds an OracleParameter to the OracleParameterCollection given the parameter name, data type, and column length.

Add(String, OracleType, Int32, String) Add(String, OracleType, Int32, String) Add(String, OracleType, Int32, String) Add(String, OracleType, Int32, String)

在给定参数名称、数据类型、列长和源列名称的情况下,将 OracleParameter 添加到 OracleParameterCollection 中。Adds an OracleParameter to the OracleParameterCollection given the parameter name, data type, column length, and source column name.

AddRange(Array) AddRange(Array) AddRange(Array) AddRange(Array)

OracleParameterCollection 的末尾添加一个值数组。Adds an array of values to the end of the OracleParameterCollection.

AddRange(OracleParameter[]) AddRange(OracleParameter[]) AddRange(OracleParameter[]) AddRange(OracleParameter[])

OracleParameter 的末尾添加一个 OracleParameterCollection 值数组。Adds an array of OracleParameter values to the end of the OracleParameterCollection.

AddWithValue(String, Object) AddWithValue(String, Object) AddWithValue(String, Object) AddWithValue(String, Object)

OracleParameterCollection 的末尾添加一个值。Adds a value to the end of the OracleParameterCollection.

Clear() Clear() Clear() Clear()

OracleParameter 中移除所有 OracleParameterCollection 对象。Removes all of the OracleParameter objects from the OracleParameterCollection.

Contains(Object) Contains(Object) Contains(Object) Contains(Object)

确定指定的对象是否在 OracleParameterCollection 中。Determines whether the specified object is in the OracleParameterCollection.

Contains(OracleParameter) Contains(OracleParameter) Contains(OracleParameter) Contains(OracleParameter)

确定指定的 OracleParameter 是否在 OracleParameterCollection 中。Determines whether the specified OracleParameter is in the OracleParameterCollection.

Contains(String) Contains(String) Contains(String) Contains(String)

指示集合中是否包含具有指定名称的 OracleParameterIndicates whether an OracleParameter with the specified name is contained in the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

将当前 OracleParameterCollection 的所有元素复制到指定的一维 Array 中,并以指定的目标 Array 索引位置作为复制到的起始位置。Copies all the elements of the current OracleParameterCollection to the specified one-dimensional Array starting at the specified destination Array index.

CopyTo(OracleParameter[], Int32) CopyTo(OracleParameter[], Int32) CopyTo(OracleParameter[], Int32) CopyTo(OracleParameter[], Int32)

将当前 OracleParameterCollection 的所有元素复制到指定的 OracleParameterCollection 中,并以指定的目标索引位置作为复制到的起始位置。Copies all the elements of the current OracleParameterCollection to the specified OracleParameterCollection starting at the specified destination index.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) 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)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回循环访问 OracleParameterCollection 的枚举数。Returns an enumerator that iterates through the OracleParameterCollection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
IndexOf(Object) IndexOf(Object) IndexOf(Object) IndexOf(Object)

获取指定的 Object 在集合中的位置。Gets the location of the specified Object within the collection.

IndexOf(OracleParameter) IndexOf(OracleParameter) IndexOf(OracleParameter) IndexOf(OracleParameter)

获取指定的 OracleParameter 在集合中的位置。Gets the location of the specified OracleParameter within the collection.

IndexOf(String) IndexOf(String) IndexOf(String) IndexOf(String)

获取具有指定名称的指定 OracleParameter 的位置。Gets the location of the specified OracleParameter with the specified name.

InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

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

(Inherited from MarshalByRefObject)
Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object) Insert(Int32, Object)

Object 插入到 OracleParameterCollection 中的指定索引位置处。Inserts a Object into the OracleParameterCollection at the specified index.

Insert(Int32, OracleParameter) Insert(Int32, OracleParameter) Insert(Int32, OracleParameter) Insert(Int32, OracleParameter)

OracleParameter 中的指定索引处插入一个 OracleParameterCollection 对象。Inserts a OracleParameter object into the OracleParameterCollection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

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

(Inherited from MarshalByRefObject)
Remove(Object) Remove(Object) Remove(Object) Remove(Object)

从集合中移除指定的 OracleParameter 对象。Removes the specified OracleParameter object from the collection.

Remove(OracleParameter) Remove(OracleParameter) Remove(OracleParameter) Remove(OracleParameter)

从集合中移除指定的 OracleParameter 对象。Removes the specified OracleParameter object from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

从集合中移除位于指定索引位置的 OracleParameter 对象。Removes the OracleParameter object at the specified index from the collection.

RemoveAt(String) RemoveAt(String) RemoveAt(String) RemoveAt(String)

从集合中删除具有指定名称的 OracleParameter 对象。Removes the OracleParameter object with the specified name from the collection.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于