DB2ParameterCollection.Add (String, Object) Method
Adds a DB2Parameter to the DB2Command given the parameter name and value.
- Namespace:
IBM.Data.DB2- Assembly:
IBM.Data.DB2(inIBM.Data.DB2.dll)
Syntax
[Visual Basic]
Overloads Public Function Add( _
ByVal parameterName As String, _
ByVal value As Object _
) As DB2Parameter
[C#]
public DB2Parameter
Add(
string parameterName,
object value
);
[C++]
public: DB2Parameter
* Add(
String* parameterName,
Object* value
);
[JScript]
public function Add(
parameterName : String,
value : Object
) : DB2Parameter
;
Parameters
- parameterName
- The name of the parameter.
- value
- The DB2®Parameter.Value of the DB2Parameter to add to the collection.
Return value
The new DB2Parameter object.
Remarks
When you specify a value, use the value parameter, and explicitly set the DB2Type as demonstrated in this C# example:
DB2Command rComm = new DB2Command(null, rConn);
rComm.CommandText = "insert into mytable values (?)";
rComm.Parameters.Add("p1", DBNull.Value);
rComm.Parameters["p1"].DB2Type = DB2Type.Integer;