dotConnect for DB2 Documentation
Devart.Data.DB2 Namespace / DB2ParameterCollection Class / Add Method / Add(String,DB2Type,Int32,String) Method
The name of the parameter.
The maximum size, in bytes, of the data the parameter can contain.
The name of the source column.
Example

In This Topic
Add(String,DB2Type,Int32,String) Method
In This Topic
Adds a DB2Parameter to the DB2ParameterCollection given the parameter name, data type, column width, and source column name.
Syntax
'Declaration
 
Public Overloads Function Add( _
   ByVal parameterName As String, _
   ByVal dbType As DB2Type, _
   ByVal size As Integer, _
   ByVal sourceColumn As String _
) As DB2Parameter
 

Parameters

parameterName
The name of the parameter.
dbType
size
The maximum size, in bytes, of the data the parameter can contain.
sourceColumn
The name of the source column.

Return Value

The new DB2Parameter object.
Example
The following example creates a DB2ParameterCollection, adds instances of DB2Parameter to the collection, and returns a reference to the new DB2Parameter.
public void CreateDB2ParamColl(DB2Connection myConn) {
  DB2Command db2Command = new DB2Command("SELECT * FROM Dept WHERE DeptNo = :DeptNo", myConn);
  DB2ParameterCollection myParamCollection = db2Command.Parameters;
  DB2Parameter myNewParameter = myParamCollection.Add("DeptNo", DB2Type.Int, 40, "DeptNo");
}
Public Sub CreateDB2ParamColl(myConn As DB2Connection)
  Dim db2Command As DB2Command = New DB2Command("SELECT * FROM Dept WHERE DeptNo = :DeptNo", myConn)
  Dim myParamCollection As DB2ParameterCollection = db2Command.Parameters
  Dim myNewParameter As DB2Parameter = myParamCollection.Add("DeptNo", DB2Type.Int, 40, "DeptNo")
End Sub
See Also