OracleParameterCollection 类

定义

表示与 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
继承
OracleParameterCollection
属性

示例

下面的示例通过 OracleDataAdapter中的 OracleParameterCollection 创建多个 OracleParameter 实例。The following example creates multiple instances of OracleParameter through the OracleParameterCollection within the OracleDataAdapter. 这些参数用于在数据库中选择数据,然后将数据放在 DataSet中。These parameters are used to select data within the database and then place the data in the DataSet. 此示例假设已使用相应的架构、命令和连接创建了 DataSetOracleDataAdapterThis 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.

用于 Oracle 的 .NET Framework 数据提供程序不支持问号(?)占位符,以便将参数传递给 CommandType.TextOracleCommand 调用的 SQL 语句。The .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  

使用 CommandType.TextOracleCommand 调用的 SQL 语句中的命名参数时,必须在参数名称前面加上冒号(:)。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 类的新实例。Initializes a new instance of the OracleParameterCollection class.

属性

Count

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

IsFixedSize

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

IsReadOnly

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

IsSynchronized

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

Item[Int32]

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

Item[String]

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

SyncRoot

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

方法

Add(Object)

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

Add(OracleParameter)

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

Add(String, Object)

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

Add(String, OracleType)

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

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)

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

AddRange(Array)

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

AddRange(OracleParameter[])

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

AddWithValue(String, Object)

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

Clear()

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

Contains(Object)

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

Contains(OracleParameter)

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

Contains(String)

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

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)

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

CreateObjRef(Type)

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

(继承自 MarshalByRefObject)
Equals(Object)

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

(继承自 Object)
GetEnumerator()

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

GetHashCode()

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

(继承自 Object)
GetLifetimeService()

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

(继承自 MarshalByRefObject)
GetParameter(Int32)

返回位于集合中指定索引处的 DbParameter 对象。Returns the DbParameter object at the specified index in the collection.

(继承自 DbParameterCollection)
GetParameter(String)

返回具有指定名称的 DbParameter 对象。Returns DbParameter the object with the specified name.

(继承自 DbParameterCollection)
GetType()

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

(继承自 Object)
IndexOf(Object)

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

IndexOf(OracleParameter)

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

IndexOf(String)

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

InitializeLifetimeService()

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

(继承自 MarshalByRefObject)
Insert(Int32, Object)

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

Insert(Int32, OracleParameter)

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

MemberwiseClone()

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

(继承自 Object)
MemberwiseClone(Boolean)

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

(继承自 MarshalByRefObject)
Remove(Object)

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

Remove(OracleParameter)

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

RemoveAt(Int32)

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

RemoveAt(String)

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

SetParameter(Int32, DbParameter)

将指定索引处的 DbParameter 对象设置为新值。Sets the DbParameter object at the specified index to a new value.

(继承自 DbParameterCollection)
SetParameter(String, DbParameter)

将具有指定名称的 DbParameter 对象设置为新值。Sets the DbParameter object with the specified name to a new value.

(继承自 DbParameterCollection)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

ICollection.IsSynchronized (继承自 DbParameterCollection)
IDataParameterCollection.Item[String]

获取或设置指定索引处的参数。Gets or sets the parameter at the specified index.

(继承自 DbParameterCollection)
IList.IsFixedSize (继承自 DbParameterCollection)
IList.IsReadOnly (继承自 DbParameterCollection)
IList.Item[Int32]

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

(继承自 DbParameterCollection)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于