OleDbParameter OleDbParameter OleDbParameter OleDbParameter Constructors

Definition

Overloads

OleDbParameter() OleDbParameter() OleDbParameter()

Initializes a new instance of the OleDbParameter class.

OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType)

Initializes a new instance of the OleDbParameter class that uses the parameter name and data type.

OleDbParameter(String, Object) OleDbParameter(String, Object) OleDbParameter(String, Object) OleDbParameter(String, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name and the value of the new OleDbParameter.

OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, and length.

OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, and source column name.

OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

OleDbParameter() OleDbParameter() OleDbParameter()

Initializes a new instance of the OleDbParameter class.

public:
 OleDbParameter();
public OleDbParameter ();
Public Sub New ()

Examples

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

public void CreateOleDbParameter() 
{
   OleDbParameter parameter = new OleDbParameter();
   parameter.ParameterName = "Description";
   parameter.OleDbType = OleDbType.VarChar;
   parameter.Direction = ParameterDirection.Output;
   parameter.Size = 88;
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter()
    parameter.ParameterName = "Description"
    parameter.OleDbType = OleDbType.VarChar
    parameter.Direction = ParameterDirection.Output
    parameter.Size = 88
End Sub 
See also

OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType) OleDbParameter(String, OleDbType)

Initializes a new instance of the OleDbParameter class that uses the parameter name and data type.

public:
 OleDbParameter(System::String ^ name, System::Data::OleDb::OleDbType dataType);
public OleDbParameter (string name, System.Data.OleDb.OleDbType dataType);
new System.Data.OleDb.OleDbParameter : string * System.Data.OleDb.OleDbType -> System.Data.OleDb.OleDbParameter
Public Sub New (name As String, dataType As OleDbType)

Parameters

name
String String String String

The name of the parameter to map.

dataType
OleDbType OleDbType OleDbType OleDbType

One of the OleDbType values.

Exceptions

The value supplied in the dataType parameter is an invalid back-end data type.

Examples

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


public void CreateOleDbParameter() 
{
   OleDbParameter parameter = new OleDbParameter("Description",OleDbType.VarChar);
   parameter.Direction = ParameterDirection.Output;
   parameter.Size = 88;
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter("Description", OleDbType.VarChar)
    parameter.Direction = ParameterDirection.Output
    parameter.Size = 88
End Sub 

Remarks

The data type, and if appropriate, Size and Precision are inferred from the value of the dataType parameter.

See also

OleDbParameter(String, Object) OleDbParameter(String, Object) OleDbParameter(String, Object) OleDbParameter(String, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name and the value of the new OleDbParameter.

public:
 OleDbParameter(System::String ^ name, System::Object ^ value);
public OleDbParameter (string name, object value);
new System.Data.OleDb.OleDbParameter : string * obj -> System.Data.OleDb.OleDbParameter
Public Sub New (name As String, value As Object)

Parameters

name
String String String String

The name of the parameter to map.

value
Object Object Object Object

The value of the new OleDbParameter object.

Examples

The following example creates an OleDbParameter.


public static void CreateOleDbParameter() 
{
   OleDbParameter myParameter = new OleDbParameter("Description", "Beverages");
}

Public Shared Sub CreateOleDbParameter() 
   Dim myParameter As OleDbParameter = New OleDbParameter("Description", "Beverages")
End Sub

Remarks

Use caution when you are using this overload of the OleDbParameter constructor to specify integer parameter values. Because this overload takes a value of type Object, you must convert the integral value to an Object type when the value is zero, as the following C# example demonstrates.

Parameter = new OleDbParameter("@pname", Convert.ToInt32(0));  

If you do not perform this conversion, the compiler assumes that you are trying to call the OleDbParameter constructor overload.

See also

OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32) OleDbParameter(String, OleDbType, Int32)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, and length.

public:
 OleDbParameter(System::String ^ name, System::Data::OleDb::OleDbType dataType, int size);
public OleDbParameter (string name, System.Data.OleDb.OleDbType dataType, int size);
new System.Data.OleDb.OleDbParameter : string * System.Data.OleDb.OleDbType * int -> System.Data.OleDb.OleDbParameter
Public Sub New (name As String, dataType As OleDbType, size As Integer)

Parameters

name
String String String String

The name of the parameter to map.

dataType
OleDbType OleDbType OleDbType OleDbType

One of the OleDbType values.

size
Int32 Int32 Int32 Int32

The length of the parameter.

Exceptions

The value supplied in the dataType parameter is an invalid back-end data type.

Examples

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


public void CreateOleDbParameter() 
{
   OleDbParameter parameter = new OleDbParameter("Description",OleDbType.VarChar,88);
   parameter.Direction = ParameterDirection.Output;
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter("Description", OleDbType.VarChar, 88)
    parameter.Direction = ParameterDirection.Output
End Sub 

Remarks

The Size is inferred from the value of the dataType parameter if it is not explicitly set in the size parameter.

See also

OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String) OleDbParameter(String, OleDbType, Int32, String)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, and source column name.

public:
 OleDbParameter(System::String ^ name, System::Data::OleDb::OleDbType dataType, int size, System::String ^ srcColumn);
public OleDbParameter (string name, System.Data.OleDb.OleDbType dataType, int size, string srcColumn);
new System.Data.OleDb.OleDbParameter : string * System.Data.OleDb.OleDbType * int * string -> System.Data.OleDb.OleDbParameter
Public Sub New (name As String, dataType As OleDbType, size As Integer, srcColumn As String)

Parameters

name
String String String String

The name of the parameter to map.

dataType
OleDbType OleDbType OleDbType OleDbType

One of the OleDbType values.

size
Int32 Int32 Int32 Int32

The length of the parameter.

srcColumn
String String String String

The name of the source column.

Exceptions

The value supplied in the dataType parameter is an invalid back-end data type.

Examples

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


public void CreateOleDbParameter() 
{
   OleDbParameter parameter = new OleDbParameter(
       "Description",OleDbType.VarChar,
       88,"Description");
   parameter.Direction = ParameterDirection.Output;
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter( _
        "Description", OleDbType.VarChar, 88, "Description")
    parameter.Direction = ParameterDirection.Output
End Sub 

Remarks

The Size is inferred from the value of the dataType parameter if it is not explicitly set in the size parameter.

See also

OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

public:
 OleDbParameter(System::String ^ parameterName, System::Data::OleDb::OleDbType dbType, int size, System::Data::ParameterDirection direction, bool isNullable, System::Byte precision, System::Byte scale, System::String ^ srcColumn, System::Data::DataRowVersion srcVersion, System::Object ^ value);
public OleDbParameter (string parameterName, System.Data.OleDb.OleDbType dbType, int size, System.Data.ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, System.Data.DataRowVersion srcVersion, object value);
new System.Data.OleDb.OleDbParameter : string * System.Data.OleDb.OleDbType * int * System.Data.ParameterDirection * bool * byte * byte * string * System.Data.DataRowVersion * obj -> System.Data.OleDb.OleDbParameter
Public Sub New (parameterName As String, dbType As OleDbType, size As Integer, direction As ParameterDirection, isNullable As Boolean, precision As Byte, scale As Byte, srcColumn As String, srcVersion As DataRowVersion, value As Object)

Parameters

parameterName
String String String String

The name of the parameter.

dbType
OleDbType OleDbType OleDbType OleDbType

One of the OleDbType values.

size
Int32 Int32 Int32 Int32

The length of the parameter.

isNullable
Boolean Boolean Boolean Boolean

true if the value of the field can be null; otherwise false.

precision
Byte Byte Byte Byte

The total number of digits to the left and right of the decimal point to which Value is resolved.

scale
Byte Byte Byte Byte

The total number of decimal places to which Value is resolved.

srcColumn
String String String String

The name of the source column.

value
Object Object Object Object

An Object that is the value of the OleDbParameter.

Exceptions

The value supplied in the dataType parameter is an invalid back-end data type.

Examples

The following example creates an OleDbParameter and displays the ParameterName.

public void CreateOleDbParameter()
{
    OleDbParameter parameter = new OleDbParameter(
        "Description", OleDbType.VarChar, 11, 
        ParameterDirection.Output, true, 0, 0, "Description",
        DataRowVersion.Current, "garden hose");
    Console.WriteLine(parameter.ToString());
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter( _
        "Description", OleDbType.VarChar, 11, _
        ParameterDirection.Output, True, 0, 0, _
        "Description", DataRowVersion.Current, "garden hose")
    Console.WriteLine(parameter.ToString())
End Sub

Remarks

The Size and Precision are inferred from the value of the dataType parameter if they are not explicitly set in the size and precision parameters.

See also

OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object) OleDbParameter(String, OleDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object)

Initializes a new instance of the OleDbParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

public:
 OleDbParameter(System::String ^ parameterName, System::Data::OleDb::OleDbType dbType, int size, System::Data::ParameterDirection direction, System::Byte precision, System::Byte scale, System::String ^ sourceColumn, System::Data::DataRowVersion sourceVersion, bool sourceColumnNullMapping, System::Object ^ value);
public OleDbParameter (string parameterName, System.Data.OleDb.OleDbType dbType, int size, System.Data.ParameterDirection direction, byte precision, byte scale, string sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value);
new System.Data.OleDb.OleDbParameter : string * System.Data.OleDb.OleDbType * int * System.Data.ParameterDirection * byte * byte * string * System.Data.DataRowVersion * bool * obj -> System.Data.OleDb.OleDbParameter
Public Sub New (parameterName As String, dbType As OleDbType, size As Integer, direction As ParameterDirection, precision As Byte, scale As Byte, sourceColumn As String, sourceVersion As DataRowVersion, sourceColumnNullMapping As Boolean, value As Object)

Parameters

parameterName
String String String String

The name of the parameter.

dbType
OleDbType OleDbType OleDbType OleDbType

One of the OleDbType values.

size
Int32 Int32 Int32 Int32

The length of the parameter.

precision
Byte Byte Byte Byte

The total number of digits to the left and right of the decimal point to which Value is resolved.

scale
Byte Byte Byte Byte

The total number of decimal places to which Value is resolved.

sourceColumn
String String String String

The name of the source column.

sourceColumnNullMapping
Boolean Boolean Boolean Boolean

true if the source column is nullable; false if it is not.

value
Object Object Object Object

An Object that is the value of the OleDbParameter.

Exceptions

The value supplied in the dataType parameter is an invalid back-end data type.

Examples

The following example creates an OleDbParameter and displays the ParameterName.

public void CreateOleDbParameter()
{
    OleDbParameter parameter = new OleDbParameter(
        "Description", OleDbType.VarChar, 11, 
        ParameterDirection.Output, true, 0, 0, "Description",
        DataRowVersion.Current, "garden hose");
    Console.WriteLine(parameter.ToString());
}
Public Sub CreateOleDbParameter()
    Dim parameter As New OleDbParameter( _
        "Description", OleDbType.VarChar, 11, _
        ParameterDirection.Output, True, 0, 0, _
        "Description", DataRowVersion.Current, "garden hose")
    Console.WriteLine(parameter.ToString())
End Sub

Remarks

The Size and Precision are inferred from the value of the dataType parameter if they are not explicitly set in the size and precision parameters.

See also

Applies to