Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DbType Property

OracleParameter.DbType Property

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Gets or sets the System.Data.DbType of the parameter.

[Visual Basic]
Public Overridable Property DbType As DbType  Implements _
   IDataParameter.DbType
[C#]
public virtual DbType DbType {get; set;}
[C++]
public: __property virtual DbType get_DbType();
public: __property virtual void set_DbType(DbType);
[JScript]
public function get DbType() : DbType;
public function set DbType(DbType);

Property Value

One of the System.Data.DbType values. The default is DbType.AnsiString.

Implements

IDataParameter.DbType

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The property was not set to a valid DbType.

Remarks

The OracleType and DbType are linked. Therefore, setting the DbType changes the OracleType to a supporting OracleType.

The DbType, OracleType, and Size properties of a parameter can be inferred by setting Value. Therefore, you are not required to specify them. However, they are not exposed in OracleParameter property settings. For example, if the size of the parameter has been inferred, Size does not contain inferred value after statement execution. For String data types the default is DbType.AnsiString.

For a list of the supported data types, see the appropriate OracleType member. For more information, see Using Parameters with a DataAdapter.

Example

[Visual Basic, C#, C++] The following example creates an OracleParameter and sets some of its properties.

[Visual Basic] 
Public Sub CreateOracleDbParameter()
    Dim myParameter As New OracleParameter()
    myParameter.ParameterName = "pDName"
    myParameter.DbType = DbType.String
    myParameter.Value = "ENGINEERING"
    myParameter.SourceColumn = "DName"
End Sub 'CreateOracleDbParameter


[C#] 
public void CreateOracleDbParameter() 
 {
    OracleParameter myParameter = new OracleParameter();
    myParameter.ParameterName = "pDName";
    myParameter.DbType = DbType.String;
    myParameter.Value = "ENGINEERING";
    myParameter.SourceColumn = "DName";
 }


[C++] 
public:
void CreateOracleDbParameter() 
 {
    OracleParameter* myParameter = new OracleParameter();
    myParameter->ParameterName = S"pDName";
    myParameter->DbType = DbType::String;
    myParameter->Value = S"ENGINEERING";
    myParameter->SourceColumn = S"DName";
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

OracleParameter Class | OracleParameter Members | System.Data.OracleClient Namespace | OracleType

Show:
© 2015 Microsoft