OleDbParameter.Value OleDbParameter.Value OleDbParameter.Value OleDbParameter.Value Property

Definition

Gets or sets the value of the parameter.

public:
 virtual property System::Object ^ Value { System::Object ^ get(); void set(System::Object ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
[System.Data.DataSysDescription("DataParameter_Value")]
public override object Value { get; set; }
member this.Value : obj with get, set
Public Overrides Property Value As Object

Property Value

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

Implements

Examples

The following example creates an OleDbParameter and sets some of its properties.

Public Sub CreateOleDbParameter()  
    Dim parameter As New OleDbParameter("Description", OleDbType.VarChar, 88)  
    parameter.Value = "garden hose"  
End Sub 'CreateOleDbParameter  
public void CreateOleDbParameter()   
 {  
    OleDbParameter parameter = new OleDbParameter("Description", OleDbType.VarChar, 88);  
    parameter.Value = "garden hose";  
 }  

Remarks

For input parameters, the value is bound to the OleDbCommand that is sent to the server. For output and return value parameters, the value is set on completion of the OleDbCommand and after the OleDbDataReader is closed.

When you send a null parameter value to the server, you must specify DBNull, not null. The null value in the system is an empty object that has no value. DBNull is used to represent null values.

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 tries to convert any type of value if it supports the IConvertible interface. Conversion errors may result if the specified type is not compatible with the value.

Both the DbType and OleDbType properties can be inferred by setting the Value.

The Value property is overwritten by the Update method of IDbDataAdapter.

Applies to

See also