This documentation is archived and is not being maintained.

OracleParameterCollection.Add Method (String, OracleType, Int32, String)

.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, data type, column length, and source column name.

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


The name of the parameter.
One of the OracleType values.
The length of the column.
The name of the source column.

Return Value

The index of the new OracleParameter object.


[Visual Basic, C#, C++] The following example creates an OracleParameterCollection, adds an instance 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 myNewParameter As OracleParameter = myParamCollection.Add("pEmpNo", OracleType.Number, 5, "EmpNo")
End Sub 'CreateOracleParamColl

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

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

[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