OracleParameter 构造函数

定义

初始化 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class.

重载

OracleParameter()

初始化 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class.

OracleParameter(String, OracleType)

初始化使用参数名称和数据类型的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name and data type.

OracleParameter(String, Object)

初始化使用参数名称和 OracleParameter 对象的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name and an OracleParameter object.

OracleParameter(String, OracleType, Int32)

初始化使用参数名称、数据类型和长度的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, and length.

OracleParameter(String, OracleType, Int32, String)

初始化使用参数名称、数据类型、长度和源列名称的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, length, and source column name.

OracleParameter(String, OracleType, Int32, ParameterDirection, String, DataRowVersion, Boolean, Object)

初始化使用参数名称、数据类型、大小、方向、源列、源版本和其他属性的 OracleParameter 类的一个新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, size, direction, source column, source version, and other properties.

OracleParameter(String, OracleType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

初始化 OracleParameter 类的新实例,该类使用参数名称、数据类型、长度、源列名、参数方向、数值精度和其他属性。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

OracleParameter()

初始化 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class.

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

OracleParameter(String, OracleType)

初始化使用参数名称和数据类型的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name and data type.

public:
 OracleParameter(System::String ^ name, System::Data::OracleClient::OracleType oracleType);
public OracleParameter (string name, System.Data.OracleClient.OracleType oracleType);
new System.Data.OracleClient.OracleParameter : string * System.Data.OracleClient.OracleType -> System.Data.OracleClient.OracleParameter

参数

name
String

参数的名称。The name of the parameter.

oracleType
OracleType

OracleType 值之一。One of the OracleType values.

异常

参数 oracleType 中提供的值不是有效的后端数据类型。The value supplied in the oracleType parameter is an invalid back-end data type.

示例

下面的示例创建一个 OracleParameter 并设置其一些属性。The following example creates an OracleParameter and sets some of its properties.

public void CreateOracleParameter() 
{
   OracleParameter parameter = new OracleParameter("DName",OracleType.VarChar);
   parameter.Direction = ParameterDirection.Output;
   parameter.Size = 14;
}
Public Sub CreateOracleParameter()
    Dim parameter As New OracleParameter("DName", OracleType.VarChar)
    parameter.Direction = ParameterDirection.Output
    parameter.Size = 14
End Sub 

OracleParameter(String, Object)

初始化使用参数名称和 OracleParameter 对象的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name and an OracleParameter object.

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

参数

name
String

参数的名称。The name of the parameter.

value
Object

OracleParameter 对象。An OracleParameter object.

注解

当你在 value 参数中指定 Object 时,DbType 将从 Object的 Microsoft .NET 框架类型推断而来。When you specify an Object in the value parameter, the DbType is inferred from the Microsoft .NET Framework type of the Object.

使用 OracleParameter 构造函数的此重载时要格外小心。Use caution when you are using this overload of the OracleParameter constructor. 由于此重载采用 Object类型的 value,因此当值为零时,必须将整数值转换为 Object 类型,如下面的 Microsoft Visual C#示例所示。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 Microsoft Visual C# example demonstrates.

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

如果不执行此转换,编译器将假定您尝试调用 OracleParameterstringOracleType)构造函数重载。If you do not perform this conversion, the compiler will assume that you are trying to call the OracleParameter(string, OracleType) constructor overload.

OracleParameter(String, OracleType, Int32)

初始化使用参数名称、数据类型和长度的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, and length.

public:
 OracleParameter(System::String ^ name, System::Data::OracleClient::OracleType oracleType, int size);
public OracleParameter (string name, System.Data.OracleClient.OracleType oracleType, int size);
new System.Data.OracleClient.OracleParameter : string * System.Data.OracleClient.OracleType * int -> System.Data.OracleClient.OracleParameter

参数

name
String

参数的名称。The name of the parameter.

oracleType
OracleType

OracleType 值之一。One of the OracleType values.

size
Int32

参数的长度。The length of the parameter.

异常

参数 oracleType 中提供的值不是有效的后端数据类型。The value supplied in the oracleType parameter is an invalid back-end data type.

示例

下面的示例创建一个 OracleParameter 并设置其一些属性。The following example creates an OracleParameter and sets some of its properties.

public void CreateOracleParameter() 
{
   OracleParameter parameter = new OracleParameter("DName",OracleType.VarChar,14);
   parameter.Direction = ParameterDirection.Output;
}
Public Sub CreateOracleParameter()
    Dim parameter As New OracleParameter("DName", OracleType.VarChar, 14)
    parameter.Direction = ParameterDirection.Output
End Sub 

OracleParameter(String, OracleType, Int32, String)

初始化使用参数名称、数据类型、长度和源列名称的 OracleParameter 类的新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, length, and source column name.

public:
 OracleParameter(System::String ^ name, System::Data::OracleClient::OracleType oracleType, int size, System::String ^ srcColumn);
public OracleParameter (string name, System.Data.OracleClient.OracleType oracleType, int size, string srcColumn);
new System.Data.OracleClient.OracleParameter : string * System.Data.OracleClient.OracleType * int * string -> System.Data.OracleClient.OracleParameter

参数

name
String

参数的名称。The name of the parameter.

oracleType
OracleType

OracleType 值之一。One of the OracleType values.

size
Int32

参数的长度。The length of the parameter.

srcColumn
String

源列的名称。The name of the source column.

异常

参数 oracleType 中提供的值不是有效的后端数据类型。The value supplied in the oracleType parameter is an invalid back-end data type.

示例

下面的示例创建一个 OracleParameter 并设置其一些属性。The following example creates an OracleParameter and sets some of its properties.

public void CreateOracleParameter() 
{
   OracleParameter parameter = new OracleParameter("DName",OracleType.VarChar,
                14,"DName");
   parameter.Direction = ParameterDirection.Output;
}
Public Sub CreateOracleParameter()
    Dim parameter As New OracleParameter("DName", OracleType.VarChar, 14, "DName")
    parameter.Direction = ParameterDirection.Output
End Sub 

OracleParameter(String, OracleType, Int32, ParameterDirection, String, DataRowVersion, Boolean, Object)

初始化使用参数名称、数据类型、大小、方向、源列、源版本和其他属性的 OracleParameter 类的一个新实例。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, size, direction, source column, source version, and other properties.

public:
 OracleParameter(System::String ^ name, System::Data::OracleClient::OracleType oracleType, int size, System::Data::ParameterDirection direction, System::String ^ sourceColumn, System::Data::DataRowVersion sourceVersion, bool sourceColumnNullMapping, System::Object ^ value);
public OracleParameter (string name, System.Data.OracleClient.OracleType oracleType, int size, System.Data.ParameterDirection direction, string sourceColumn, System.Data.DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value);
new System.Data.OracleClient.OracleParameter : string * System.Data.OracleClient.OracleType * int * System.Data.ParameterDirection * string * System.Data.DataRowVersion * bool * obj -> System.Data.OracleClient.OracleParameter

参数

name
String

要映射的参数的名称。The name of the parameter to map.

oracleType
OracleType

OracleType 值之一。One of the OracleType values.

size
Int32

参数的长度。The length of the parameter.

direction
ParameterDirection

ParameterDirection 值之一。One of the ParameterDirection values.

sourceColumn
String

源列的名称。The name of the source column.

sourceVersion
DataRowVersion

DataRowVersion 值之一。One of the DataRowVersion values.

sourceColumnNullMapping
Boolean

如果源列可为 null,则为 true;否则为 falsetrue if the source column is nullable, otherwise false.

value
Object

作为 Object 的值的 OracleParameterAn Object that is the value of the OracleParameter.

异常

参数 oracleType 中提供的值不是有效的后端数据类型。The value supplied in the oracleType parameter is an invalid back-end data type.

OracleParameter(String, OracleType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

初始化 OracleParameter 类的新实例,该类使用参数名称、数据类型、长度、源列名、参数方向、数值精度和其他属性。Initializes a new instance of the OracleParameter class that uses the parameter name, data type, length, source column name, parameter direction, numeric precision, and other properties.

public:
 OracleParameter(System::String ^ name, System::Data::OracleClient::OracleType oracleType, 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 OracleParameter (string name, System.Data.OracleClient.OracleType oracleType, int size, System.Data.ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, System.Data.DataRowVersion srcVersion, object value);
new System.Data.OracleClient.OracleParameter : string * System.Data.OracleClient.OracleType * int * System.Data.ParameterDirection * bool * byte * byte * string * System.Data.DataRowVersion * obj -> System.Data.OracleClient.OracleParameter

参数

name
String

参数的名称。The name of the parameter.

oracleType
OracleType

OracleType 值之一。One of the OracleType values.

size
Int32

参数的长度。The length of the parameter.

direction
ParameterDirection

ParameterDirection 值之一。One of the ParameterDirection values.

isNullable
Boolean

如果该字段的值可为 null,则为 true;否则为 falsetrue if the value of the field can be null, otherwise, false.

precision
Byte

所解析的 Value 的小数点左右两侧的总位数。The total number of digits to the left and right of the decimal point to which Value is resolved.

scale
Byte

所解析的 Value 的总小数位数。The total number of decimal places to which Value is resolved.

srcColumn
String

源列的名称。The name of the source column.

srcVersion
DataRowVersion

DataRowVersion 值之一。One of the DataRowVersion values.

value
Object

作为 Object 的值的 OracleParameterAn Object that is the value of the OracleParameter.

异常

参数 oracleType 中提供的值不是有效的后端数据类型。The value supplied in the oracleType parameter is an invalid back-end data type.

示例

下面的示例创建一个 OracleParameter 并显示 ParameterNameThe following example creates an OracleParameter and displays the ParameterName.

public void CreateOracleParameter() 
 {
    OracleParameter parameter = new OracleParameter(
        "DName",OracleType.VarChar,
        11,ParameterDirection.Output,true,0,0,"DName",
        DataRowVersion.Current,"ENGINEERING");
    Console.WriteLine(parameter.ToString());
 }
Public Sub CreateOracleParameter()
    Dim parameter As New OracleParameter( _
        "DName", OracleType.VarChar, 11, _
        ParameterDirection.Output, True, 0, 0, _
        "DName", DataRowVersion.Current, "ENGINEERING")
    Console.WriteLine(parameter.ToString())
End Sub 

适用于