DB2Parameter.Value Property

Gets or sets the value of the parameter.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


[Visual Basic]
Public Property Value As Object  Implements IDataParameter.Value
[C#]
public object Value {get; set;}
[C++]
public: __property Object* get_Value();
public: __property void set_Value(Object*);
[JScript]
public function get Value() : Object;
public function set Value(Object);
Implements:
IDataParameter.Value

Property value

An Object that is the value of the parameter. The default value is null.

Remarks

For input parameters, the value is bound to the DB2®Command that is sent to the server. For output and return-value parameters, the value is set on completion of the DB2Command.

When sending a null parameter value to the server, the user can specify DBNull or null.

If the application specifies the database type, the bound value is converted to that type when the provider sends the data to the server. The provider attempts to convert any type of value. Conversion errors may result if the specified type is not compatible with the value.

Both the DbType and DB2Type properties can be inferred by setting Value. If applicable, the size, precision and scale will also be inferred from Value.

The Value property can be used to set parameter value to array of values.

The Value property is overwritten by the DataAdapter.Update method.

Example

[Visual Basic, C#] The following example creates a DB2Parameter and sets some of its properties.

[Visual Basic]
Public Sub CreateDB2Parameter()
    Dim myParameter As New DB2Parameter("Description", DB2Type.VarChar, 88)
    myParameter.Value = "garden hose"
End Sub 'CreateDB2Parameter

[C#]
public void CreateDB2Parameter()
 {
    DB2Parameter myParameter = new DB2Parameter("Description", DB2Type.VarChar, 88);
    myParameter.Value = "garden hose";
 }