ODBCDatabase.DataTypeInfo

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

ODBCDatabase.DataTypeInfo(DataType as Integer) As RowSet

New in 2019r2

Supported for all project types and targets.

Returns a RowSet containing information about data types supported by the data source.

Notes

The DataType specifies the type for which the information should be returned.

Use ODBCConstant values for the data types.

To return a RecordSet containing all defined types, specify ODBCConstant.SQL_ALL_TYPES.

The returned RowSet typically contains these columns, but they could vary depending on the driver being used:

  • Data Type Name
  • Data Type integer value
  • Column size

Microsoft provides additional information about the SQLGetTypeInfo ODBC function.

Example

Displays all the supported data types for the current ODBC connection in a ListBox:

Var db As New ODBCDatabase
db.DataSource = "TeamExample"

Try
db.Connect

Var rs As RowSet
rs = db.DataTypeInfo(ODBCConstant.SQL_ALL_TYPES)

If rs <> Nil Then
For Each row As DatabaseRow In rs
ListBox1.AddRow(rs.ColumnAt(0).StringValue)
Next
End If
Catch error As DatabaseException
MessageBox("Connection failed. Error:" + error.ErrorMessage)
End Try