This documentation is archived and is not being maintained.

OracleParameterCollection.Add Method (String, OracleType)

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

Adds an OracleParameter to the OracleParameterCollection given the parameter name and data type.

[Visual Basic]
Overloads Public Function Add( _
   ByVal parameterName As String, _
   ByVal dataType As OracleType _
) As OracleParameter
public OracleParameter Add(
 string parameterName,
 OracleType dataType
public: OracleParameter* Add(
 String* parameterName,
 OracleType dataType
public function Add(
   parameterName : String,
 dataType : OracleType
) : OracleParameter;


The name of the parameter.
One of the OracleType values.

Return Value

The index of the new OracleParameter object.


[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