DB2Parameter.DbType Property

Gets or sets the DbType of the parameter.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax


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

Property value

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

Exceptions

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

Remarks

The DB2®Type and DbType properties are linked. Therefore, setting the DB2Type changes the DbType to a supporting DbType. Conversely, setting the DbType changes the DB2Type to a supporting DB2Type.

For a list of the supported data types, see the appropriate DbType member.

Note: Object is not supported by the IBM® Data Server Provider for .NET.

Example

[Visual Basic, C#] The following example creates a DB2Parameter and sets some of its properties, including the DbType Property.

[Visual Basic]
Public Sub CreateDB2Parameter()
    Dim myParameter As New DB2Parameter()
    myParameter.ParameterName = "Description"
    myParameter.DbType = DbType.String
    myParameter.Direction = ParameterDirection.Output
    myParameter.Size = 88
End Sub 'CreateDB2Parameter
[C#]
public void CreateDB2Parameter()
 {
    DB2Parameter myParameter = new DB2Parameter();
    myParameter.ParameterName = "Description";
    myParameter.DbType = DbType.String;
    myParameter.Direction = ParameterDirection.Output;
    myParameter.Size = 88;
 }