OleDbParameter.Value Property

Definition

Gets or sets the value of the parameter.

C#
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
public override object? Value { get; set; }
C#
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
[System.Data.DataSysDescription("DataParameter_Value")]
public object Value { get; set; }
C#
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
public override object Value { get; set; }

Property Value

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

Implements

Attributes

Examples

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

C#
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

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

See also