This documentation is archived and is not being maintained.

OleDbParameter.DbType Property

Gets or sets the DbType of the parameter.

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

Property Value

One of the DbType values. The default is String.




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


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

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


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

[Visual Basic] 
Public Sub CreateOleDbParameter()
    Dim myParameter As New OleDbParameter("Description", OleDbType.VarChar, 88)
    myParameter.Direction = ParameterDirection.Output
End Sub 'CreateOleDbParameter

public void CreateOleDbParameter() 
    OleDbParameter myParameter = new OleDbParameter("Description", OleDbType.VarChar, 88);
    myParameter.Direction = ParameterDirection.Output;

void CreateOleDbParameter() 
    OleDbParameter* myParameter = new OleDbParameter(S"Description", OleDbType::VarChar, 88);
    myParameter->Direction = ParameterDirection::Output;

[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.


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

See Also

OleDbParameter Class | OleDbParameter Members | System.Data.OleDb Namespace | OleDbType