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.
For a list of all members of this type, see OracleParameterCollection Members.
System.Object
System.MarshalByRefObject
System.Data.OracleClient.OracleParameterCollection
[Visual Basic] NotInheritable Public Class OracleParameterCollection Inherits MarshalByRefObject Implements IDataParameterCollection, IList, ICollection, _ IEnumerable [C#] public sealed class OracleParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable [C++] public __gc __sealed class OracleParameterCollection : public MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable [JScript] public class OracleParameterCollection extends MarshalByRefObject implements IDataParameterCollection, IList, ICollection, IEnumerable
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
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 or stored procedure, you must precede the parameter name with a colon (:). However, when referring to a named parameter elsewhere in your code (for example, when calling Add), do not precede the named parameter with a colon (:). The data provider supplies the colon automatically.
Example
[Visual Basic, C#, C++] 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.
[Visual Basic] Public Sub AddOracleParameters() ' ... ' create myDataSet and myDataAdapter ' ... myDataAdapter.SelectCommand.Parameters.Add("pEName", OracleType.VarChar, 80).Value = "Smith" myDataAdapter.SelectCommand.Parameters.Add("pEmpNo", OracleType.Int32).Value = 7369 myDataAdapter.Fill(myDataSet) End Sub 'AddOracleParameters [C#] public void AddOracleParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter.SelectCommand.Parameters.Add("pEName", OracleType.VarChar, 80).Value = "Smith"; myDataAdapter.SelectCommand.Parameters.Add("pEmpNo", OracleType.Int32).Value = 7369; myDataAdapter.Fill(myDataSet); } [C++] public: void AddOracleParameters() { // ... // create myDataSet and myDataAdapter // ... myDataAdapter->SelectCommand->Parameters->Add(S"pEName", OracleType::VarChar, 80)->Value = S"Smith"; myDataAdapter->SelectCommand->Parameters->Add(S"pEmpNo", OracleType::Int32)->Value = __box(7369); myDataAdapter->Fill(myDataSet); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Data.OracleClient
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Data.Oracleclient (in System.Data.Oracleclient.dll)
See Also
OracleParameterCollection Members | System.Data.OracleClient Namespace