Editare

Partajați prin


OdbcParameter Constructors

Definition

Initializes a new instance of the OdbcParameter class.

Overloads

OdbcParameter()

Initializes a new instance of the OdbcParameter class.

OdbcParameter(String, OdbcType)

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

OdbcParameter(String, Object)

Initializes a new instance of the OdbcParameter class that uses the parameter name and an OdbcParameter object.

OdbcParameter(String, OdbcType, Int32)

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

OdbcParameter(String, OdbcType, Int32, String)

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

OdbcParameter(String, OdbcType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

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

OdbcParameter(String, OdbcType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object)

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

OdbcParameter()

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

Initializes a new instance of the OdbcParameter class.

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

Examples

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

public void CreateOdbcParameter()
{
   OdbcParameter parameter = new OdbcParameter();
   parameter.ParameterName = "Description";
   parameter.OdbcType = OdbcType.VarChar;
   parameter.Direction = ParameterDirection.Output;
   parameter.Size = 88;
}
Public Sub CreateOdbcParameter()
    Dim parameter As New OdbcParameter()
    parameter.ParameterName = "Description"
    parameter.OdbcType = OdbcType.VarChar
    parameter.Direction = ParameterDirection.Output
    parameter.Size = 88
End Sub

Remarks

The base constructor initializes all fields to their default values.

See also

Applies to

OdbcParameter(String, OdbcType)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

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

public:
 OdbcParameter(System::String ^ name, System::Data::Odbc::OdbcType type);
public OdbcParameter (string? name, System.Data.Odbc.OdbcType type);
public OdbcParameter (string name, System.Data.Odbc.OdbcType type);
new System.Data.Odbc.OdbcParameter : string * System.Data.Odbc.OdbcType -> System.Data.Odbc.OdbcParameter
Public Sub New (name As String, type As OdbcType)

Parameters

name
String

The name of the parameter.

type
OdbcType

One of the OdbcType values.

Exceptions

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

Examples

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


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

See also

Applies to

OdbcParameter(String, Object)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

Initializes a new instance of the OdbcParameter class that uses the parameter name and an OdbcParameter object.

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

Parameters

name
String

The name of the parameter.

value
Object

An OdbcParameter object.

Remarks

Use caution when you are using this overload of the OdbcParameter 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 OdbcParameter("@pname", Convert.ToInt32(0));  

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

See also

Applies to

OdbcParameter(String, OdbcType, Int32)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

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

public:
 OdbcParameter(System::String ^ name, System::Data::Odbc::OdbcType type, int size);
public OdbcParameter (string? name, System.Data.Odbc.OdbcType type, int size);
public OdbcParameter (string name, System.Data.Odbc.OdbcType type, int size);
new System.Data.Odbc.OdbcParameter : string * System.Data.Odbc.OdbcType * int -> System.Data.Odbc.OdbcParameter
Public Sub New (name As String, type As OdbcType, size As Integer)

Parameters

name
String

The name of the parameter.

type
OdbcType

One of the OdbcType values.

size
Int32

The length of the parameter.

Exceptions

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

Examples

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


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

See also

Applies to

OdbcParameter(String, OdbcType, Int32, String)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

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

public:
 OdbcParameter(System::String ^ name, System::Data::Odbc::OdbcType type, int size, System::String ^ sourcecolumn);
public OdbcParameter (string? name, System.Data.Odbc.OdbcType type, int size, string? sourcecolumn);
public OdbcParameter (string name, System.Data.Odbc.OdbcType type, int size, string sourcecolumn);
new System.Data.Odbc.OdbcParameter : string * System.Data.Odbc.OdbcType * int * string -> System.Data.Odbc.OdbcParameter
Public Sub New (name As String, type As OdbcType, size As Integer, sourcecolumn As String)

Parameters

name
String

The name of the parameter.

type
OdbcType

One of the OdbcType values.

size
Int32

The length of the parameter.

sourcecolumn
String

The name of the source column.

Exceptions

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

Examples

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

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

See also

Applies to

OdbcParameter(String, OdbcType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

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

public:
 OdbcParameter(System::String ^ parameterName, System::Data::Odbc::OdbcType odbcType, int size, System::Data::ParameterDirection parameterDirection, bool isNullable, System::Byte precision, System::Byte scale, System::String ^ srcColumn, System::Data::DataRowVersion srcVersion, System::Object ^ value);
public OdbcParameter (string? parameterName, System.Data.Odbc.OdbcType odbcType, int size, System.Data.ParameterDirection parameterDirection, bool isNullable, byte precision, byte scale, string? srcColumn, System.Data.DataRowVersion srcVersion, object? value);
public OdbcParameter (string parameterName, System.Data.Odbc.OdbcType odbcType, int size, System.Data.ParameterDirection parameterDirection, bool isNullable, byte precision, byte scale, string srcColumn, System.Data.DataRowVersion srcVersion, object value);
new System.Data.Odbc.OdbcParameter : string * System.Data.Odbc.OdbcType * int * System.Data.ParameterDirection * bool * byte * byte * string * System.Data.DataRowVersion * obj -> System.Data.Odbc.OdbcParameter
Public Sub New (parameterName As String, odbcType As OdbcType, size As Integer, parameterDirection As ParameterDirection, isNullable As Boolean, precision As Byte, scale As Byte, srcColumn As String, srcVersion As DataRowVersion, value As Object)

Parameters

parameterName
String

The name of the parameter.

odbcType
OdbcType

One of the OdbcType values.

size
Int32

The length of the parameter.

parameterDirection
ParameterDirection

One of the ParameterDirection values.

isNullable
Boolean

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

precision
Byte

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

scale
Byte

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

srcColumn
String

The name of the source column.

srcVersion
DataRowVersion

One of the DataRowVersion values.

value
Object

An Object that is the value of the OdbcParameter.

Exceptions

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

Examples

The following example creates an OdbcParameter and displays the ParameterName.

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

See also

Applies to

OdbcParameter(String, OdbcType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object)

Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs
Source:
OdbcParameter.cs

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

public:
 OdbcParameter(System::String ^ parameterName, System::Data::Odbc::OdbcType odbcType, int size, System::Data::ParameterDirection parameterDirection, System::Byte precision, System::Byte scale, System::String ^ sourceColumn, System::Data::DataRowVersion sourceVersion, bool sourceColumnNullMapping, System::Object ^ value);
public OdbcParameter (string? parameterName, System.Data.Odbc.OdbcType odbcType, int size, System.Data.ParameterDirection parameterDirection, byte precision, byte scale, string? sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object? value);
public OdbcParameter (string parameterName, System.Data.Odbc.OdbcType odbcType, int size, System.Data.ParameterDirection parameterDirection, byte precision, byte scale, string sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value);
new System.Data.Odbc.OdbcParameter : string * System.Data.Odbc.OdbcType * int * System.Data.ParameterDirection * byte * byte * string * System.Data.DataRowVersion * bool * obj -> System.Data.Odbc.OdbcParameter
Public Sub New (parameterName As String, odbcType As OdbcType, size As Integer, parameterDirection As ParameterDirection, precision As Byte, scale As Byte, sourceColumn As String, sourceVersion As DataRowVersion, sourceColumnNullMapping As Boolean, value As Object)

Parameters

parameterName
String

The name of the parameter.

odbcType
OdbcType

One of the OdbcType values.

size
Int32

The length of the parameter.

parameterDirection
ParameterDirection

One of the ParameterDirection values.

precision
Byte

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

scale
Byte

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

sourceColumn
String

The name of the source column.

sourceVersion
DataRowVersion

One of the DataRowVersion values.

sourceColumnNullMapping
Boolean

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

value
Object

An Object that is the value of the OdbcParameter.

Exceptions

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

Examples

The following example creates an OdbcParameter and displays the ParameterName.

Public Sub CreateOdbcParameter()  
  Dim parameter As New OdbcParameter("Description", OdbcType.VarChar, 11, ParameterDirection.Output, True, 0, 0, "Description", DataRowVersion.Current, False, "garden hose")  
  MessageBox.Show(parameter.ToString())  
End Sub  
public void CreateOdbcParameter()   
{  
  OdbcParameter parameter = new OdbcParameter("Description",OdbcType.VarChar,  
              11,ParameterDirection.Output,true,0,0,"Description",  
              DataRowVersion.Current, false, "garden hose");  
  MessageBox.Show(parameter.ToString());  
}  

See also

Applies to