Export (0) Print
Expand All

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
[C#]
public OracleParameter Add(
 string parameterName,
 OracleType dataType,
 int size,
 string srcColumn
);
[C++]
public: OracleParameter* Add(
 String* parameterName,
 OracleType dataType,
 int size,
 String* srcColumn
);
[JScript]
public function Add(
   parameterName : String,
 dataType : OracleType,
 size : int,
 srcColumn : String
) : OracleParameter;

Parameters

parameterName
The name of the parameter.
dataType
One of the OracleType values.
size
The length of the column.
srcColumn
The name of the source column.

Return Value

The index of the new OracleParameter object.

Example

[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

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

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

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