Adds the specified DB2Parameter to the collection.
| Name | Description |
|---|---|
| Add(Object) As Integer Implements IList.Add | Adds the specified DB2Parameter to the DB2Command . |
| Add(DB2Parameter) As DB2Parameter | Adds the specified DB2Parameter to the DB2ParameterCollection . |
| Add(String, Object) As DB2Parameter | Adds a DB2Parameter to the DB2Command given the parameter name and value. |
| Add(String, DB2Type) As DB2Parameter | Adds a DB2Parameter to the DB2Command given the parameter name and data type. |
| Add(String, DB2Type, Integer) As DB2Parameter | Adds a DB2Parameter to the DB2Command given the the parameter name, data type, and column width. |
| Add(String, DB2Type, Integer, String) As DB2Parameter | Adds a DB2Parameter to the DB2Command given the parameter name, data type, column width, and source column name. |
[Visual Basic, C#] The following example creates a DB2Command , a DB2ParameterCollection for the command, and adds an instance of DB2Parameter to the collection.
[Visual Basic]
Public Sub CreateDB2ParamColl(myConn As DB2Connection)
Dim myCommand As DB2Command =
New DB2Command("SELECT * FROM EMPLOYEE WHERE EMPNO = ?", myConn)
Dim myParamCollection As DB2ParameterCollection = myCommand.Parameters
Dim myNewParameter As DB2Parameter =
myParamCollection.Add("EMPNO", DB2Type.VarChar, 6, "EMPNO")
End Sub 'CreateDB2ParamColl
[C#]
public void CreateDB2ParamColl(DB2Connection myConn) {
DB2Command myCommand =
new DB2Command("SELECT * FROM EMPLOYEE WHERE EMPNO = ?", myConn);
DB2ParameterCollection myParamCollection = myCommand.Parameters;
DB2Parameter myNewParameter =
myParamCollection.Add("EMPNO", DB2Type.VarChar, 6, "EMPNO");
}