dotConnect for DB2 Documentation
Devart.Data.DB2 Namespace / DB2ParameterCollection Class / Add Method / Add(String,DB2Type) Method
The name of the parameter.
One of the DB2Type values.
Example

In This Topic
    Add(String,DB2Type) Method
    In This Topic
    Adds a DB2Parameter to the DB2ParameterCollection given the parameter name and data type.
    Syntax
    'Declaration
     
    Public Overloads Function Add( _
       ByVal parameterName As String, _
       ByVal type As DB2Type _
    ) As DB2Parameter
    public DB2Parameter Add( 
       string parameterName,
       DB2Type type
    )

    Parameters

    parameterName
    The name of the parameter.
    type
    One of the DB2Type values.

    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;
      object myParm = new DB2Parameter("DeptNo", DB2Type.Int);
      int pIndex = myParamCollection.Add(myParm);
    }
    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 myParm As Object = New DB2Parameter("DeptNo", DB2Type.Int)
      Dim pIndex As Integer = myParamCollection.Add(myParm)
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also