Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

OracleParameterCollection.Add Method (OracleParameter)

.NET Framework 1.1
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Adds the specified OracleParameter to the OracleParameterCollection.

[Visual Basic]
Overloads Public Function Add( _
   ByVal value As OracleParameter _
) As OracleParameter
public OracleParameter Add(
 OracleParameter value
public: OracleParameter* Add(
 OracleParameter* value
public function Add(
   value : OracleParameter
) : OracleParameter;


The OracleParameter to add to the collection.

Return Value

The index of the new OracleParameter object.


Exception Type Condition
ArgumentException The OracleParameter specified in the value parameter is already added to this or another OracleParameterCollection.
ArgumentNullException The value parameter is null.


[Visual Basic, C#, C++] The following example creates an OracleParameterCollection, adds instances of OracleParameter to the collection, and returns a reference to the new OracleParameter.

[Visual Basic] 
Public Sub CreateOracleParamColl(myConn As OracleConnection)
  Dim myCommand As OracleCommand = New OracleCommand("SELECT Ename, DeptNo FROM Emp WHERE EmpNo = :pEmpNo", myConn)
  Dim myParamCollection As OracleParameterCollection = myCommand.Parameters
  Dim myParm As Object = New OracleParameter("pEmpNo", OracleType.Number)
  Dim pIndex As Integer = myParamCollection.Add(myParm)
End Sub 'CreateOracleParamColl

public void CreateOracleParamColl() {
    OracleCommand myCommand = new OracleCommand("SELECT Ename, DeptNo FROM Emp WHERE EmpNo = :pEmpNo", myConn);
    OracleParameterCollection myParamCollection = myCommand.Parameters;
    object myParm = new OracleParameter("pEmpNo", OracleType.Number);
    int pIndex = myParamCollection.Add(myParm);

void CreateOracleParamColl() {
    OracleCommand* myCommand = new OracleCommand(S"SELECT Ename, DeptNo FROM Emp WHERE EmpNo = :pEmpNo", myConn);
    OracleParameterCollection* myParamCollection = myCommand->Parameters;
    Object* myParm = new OracleParameter(S"pEmpNo", OracleType::Number);
    int pIndex = myParamCollection->Add(myParm);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

OracleParameterCollection Class | OracleParameterCollection Members | System.Data.OracleClient Namespace | OracleParameterCollection.Add Overload List

© 2015 Microsoft