1 out of 1 rated this helpful - Rate this topic

OracleParameterCollection Class

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.

System.Object
  System.MarshalByRefObject
    System.Data.Common.DbParameterCollection
      System.Data.OracleClient.OracleParameterCollection

Namespace:  System.Data.OracleClient
Assembly:  System.Data.OracleClient (in System.Data.OracleClient.dll)
[ListBindableAttribute(false)]
public sealed class OracleParameterCollection : DbParameterCollection

The OracleParameterCollection type exposes the following members.

  Name Description
Public method OracleParameterCollection Initializes a new instance of the OracleParameterCollection class.
Top
  Name Description
Public property Count Returns an Integer containing the number of elements in the OracleParameterCollection. Read-only. (Overrides DbParameterCollection.Count.)
Public property IsFixedSize Gets a value that indicates whether the OracleParameterCollection has a fixed size. (Overrides DbParameterCollection.IsFixedSize.)
Public property IsReadOnly Gets a value that indicates whether the OracleParameterCollection is read-only. (Overrides DbParameterCollection.IsReadOnly.)
Public property IsSynchronized Gets a value that indicates whether the OracleParameterCollection is synchronized. (Overrides DbParameterCollection.IsSynchronized.)
Public property Item[Int32] Gets or sets the OracleParameter at the specified index.
Public property Item[String] Gets or sets the OracleParameter with the specified name.
Public property SyncRoot Gets an object that can be used to synchronize access to the OracleParameterCollection. (Overrides DbParameterCollection.SyncRoot.)
Top
  Name Description
Public method Add(Object) Adds the specified OracleParameter object to the OracleParameterCollection. (Overrides DbParameterCollection.Add(Object).)
Public method Add(OracleParameter) Adds the specified OracleParameter to the OracleParameterCollection.
Public method Add(String, OracleType) Adds an OracleParameter to the OracleParameterCollection given the parameter name and data type.
Public method Add(String, Object) Obsolete. Adds an OracleParameter to the OracleParameterCollection given the parameter name and value.
Public method Add(String, OracleType, Int32) Adds an OracleParameter to the OracleParameterCollection given the parameter name, data type, and column length.
Public method Add(String, OracleType, Int32, String) Adds an OracleParameter to the OracleParameterCollection given the parameter name, data type, column length, and source column name.
Public method AddRange(Array) Adds an array of values to the end of the OracleParameterCollection. (Overrides DbParameterCollection.AddRange(Array).)
Public method AddRange(OracleParameter[]) Adds an array of OracleParameter values to the end of the OracleParameterCollection.
Public method AddWithValue Adds a value to the end of the OracleParameterCollection.
Public method Clear Removes all of the OracleParameter objects from the OracleParameterCollection. (Overrides DbParameterCollection.Clear().)
Public method Contains(Object) Determines whether the specified object is in the OracleParameterCollection. (Overrides DbParameterCollection.Contains(Object).)
Public method Contains(OracleParameter) Determines whether the specified OracleParameter is in the OracleParameterCollection.
Public method Contains(String) Indicates whether an OracleParameter with the specified name is contained in the collection. (Overrides DbParameterCollection.Contains(String).)
Public method CopyTo(Array, Int32) Copies all the elements of the current OracleParameterCollection to the specified one-dimensional Array starting at the specified destination Array index. (Overrides DbParameterCollection.CopyTo(Array, Int32).)
Public method CopyTo(OracleParameter[], Int32) Copies all the elements of the current OracleParameterCollection to the specified OracleParameterCollection starting at the specified destination index.
Public method 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.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetEnumerator Returns an enumerator that iterates through the OracleParameterCollection. (Overrides DbParameterCollection.GetEnumerator().)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method GetParameter(Int32) Returns the DbParameter object at the specified index in the collection. (Inherited from DbParameterCollection.)
Protected method GetParameter(String) Returns DbParameter the object with the specified name. (Inherited from DbParameterCollection.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IndexOf(Object) Gets the location of the specified Object within the collection. (Overrides DbParameterCollection.IndexOf(Object).)
Public method IndexOf(OracleParameter) Gets the location of the specified OracleParameter within the collection.
Public method IndexOf(String) Gets the location of the specified OracleParameter with the specified name. (Overrides DbParameterCollection.IndexOf(String).)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method Insert(Int32, OracleParameter) Inserts a OracleParameter object into the OracleParameterCollection at the specified index.
Public method Insert(Int32, Object) Inserts a Object into the OracleParameterCollection at the specified index. (Overrides DbParameterCollection.Insert(Int32, Object).)
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public method Remove(Object) Removes the specified OracleParameter object from the collection. (Overrides DbParameterCollection.Remove(Object).)
Public method Remove(OracleParameter) Removes the specified OracleParameter object from the collection.
Public method RemoveAt(Int32) Removes the OracleParameter object at the specified index from the collection. (Overrides DbParameterCollection.RemoveAt(Int32).)
Public method RemoveAt(String) Removes the OracleParameter object with the specified name from the collection. (Overrides DbParameterCollection.RemoveAt(String).)
Protected method SetParameter(Int32, DbParameter) Sets the DbParameter object at the specified index to a new value. (Inherited from DbParameterCollection.)
Protected method SetParameter(String, DbParameter) Sets the DbParameter object with the specified name to a new value. (Inherited from DbParameterCollection.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top
  Name Description
Explicit interface implemetation Private property IDataParameterCollection.Item Gets or sets the parameter at the specified index. (Inherited from DbParameterCollection.)
Explicit interface implemetation Private property IList.Item Gets or sets the element at the specified index. (Inherited from DbParameterCollection.)
Top

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.

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

When using named parameters in an SQL statement called by an OracleCommand of CommandType.Text, you must precede the parameter name with a colon (:). 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.

The following example creates multiple instances of OracleParameter through the OracleParameterCollection within the OracleDataAdapter. These parameters are used to select data within the database and then place the data in the DataSet. 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);
 }



.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1

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.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ