OracleParameter Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the OracleParameter class.
Overloads
OracleParameter() |
Initializes a new instance of the OracleParameter class. |
OracleParameter(String, OracleType) |
Initializes a new instance of the OracleParameter class that uses the parameter name and data type. |
OracleParameter(String, Object) |
Initializes a new instance of the OracleParameter class that uses the parameter name and an OracleParameter object. |
OracleParameter(String, OracleType, Int32) |
Initializes a new instance of the OracleParameter class that uses the parameter name, data type, and length. |
OracleParameter(String, OracleType, Int32, String) |
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) |
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) |
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()
Initializes a new instance of the OracleParameter class.
public:
OracleParameter();
public OracleParameter ();
Public Sub New ()
Applies to
OracleParameter(String, OracleType)
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
Public Sub New (name As String, oracleType As OracleType)
Parameters
- name
- String
The name of the parameter.
- oracleType
- OracleType
One of the OracleType values.
Exceptions
The value supplied in the oracleType
parameter is an invalid back-end data type.
Examples
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
Applies to
OracleParameter(String, Object)
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)
Parameters
- name
- String
The name of the parameter.
- value
- Object
An OracleParameter object.
Remarks
When you specify an Object in the value
parameter, the DbType is inferred from the Microsoft .NET Framework type of the Object.
Use caution when you are using this overload of the OracleParameter constructor. 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));
If you do not perform this conversion, the compiler will assume that you are trying to call the OracleParameter
(string
, OracleType
) constructor overload.
Applies to
OracleParameter(String, OracleType, Int32)
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
Public Sub New (name As String, oracleType As OracleType, size As Integer)
Parameters
- name
- String
The name of the parameter.
- oracleType
- OracleType
One of the OracleType values.
- size
- Int32
The length of the parameter.
Exceptions
The value supplied in the oracleType
parameter is an invalid back-end data type.
Examples
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
Applies to
OracleParameter(String, OracleType, Int32, String)
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
Public Sub New (name As String, oracleType As OracleType, size As Integer, srcColumn As String)
Parameters
- name
- String
The name of the parameter.
- oracleType
- OracleType
One of the OracleType values.
- size
- Int32
The length of the parameter.
- srcColumn
- String
The name of the source column.
Exceptions
The value supplied in the oracleType
parameter is an invalid back-end data type.
Examples
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
Applies to
OracleParameter(String, OracleType, Int32, ParameterDirection, String, DataRowVersion, Boolean, Object)
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
Public Sub New (name As String, oracleType As OracleType, size As Integer, direction As ParameterDirection, sourceColumn As String, sourceVersion As DataRowVersion, sourceColumnNullMapping As Boolean, value As Object)
Parameters
- name
- String
The name of the parameter to map.
- oracleType
- OracleType
One of the OracleType values.
- size
- Int32
The length of the parameter.
- direction
- ParameterDirection
One of the ParameterDirection values.
- sourceColumn
- String
The name of the source column.
- sourceVersion
- DataRowVersion
One of the DataRowVersion values.
- sourceColumnNullMapping
- Boolean
true
if the source column is nullable, otherwise false
.
- value
- Object
An Object that is the value of the OracleParameter.
Exceptions
The value supplied in the oracleType
parameter is an invalid back-end data type.
Applies to
OracleParameter(String, OracleType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)
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
Public Sub New (name As String, oracleType As OracleType, 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
- name
- String
The name of the parameter.
- oracleType
- OracleType
One of the OracleType values.
- size
- Int32
The length of the parameter.
- direction
- 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.
- 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 OracleParameter.
Exceptions
The value supplied in the oracleType
parameter is an invalid back-end data type.
Examples
The 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