Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

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
[C#]
public OracleParameter Add(
 OracleParameter value
);
[C++]
public: OracleParameter* Add(
 OracleParameter* value
);
[JScript]
public function Add(
   value : OracleParameter
) : OracleParameter;

Parameters

value
The OracleParameter to add to the collection.

Return Value

The index of the new OracleParameter object.

Exceptions

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.

Example

[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

[C#] 
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);
 }

[C++] 
public:
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.

Requirements

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

Show:
© 2014 Microsoft. All rights reserved.