The following example illustrates use of the hDbc property when executing an ODBC API function. In this case, the application sets a connection option that changes how transactions are isolated.
Option Explicit
Dim en As rdoEnvironment
Dim cn As rdoConnection
Dim rc As Integer
'Declare Function SQLSetConnectOption Lib "odbc32.dll" (ByVal hdbc&, ByVal fOption%, ByVal vParam As Any) As Integer
'
'Transaction isolation option masks
'
Const SQL_TXN_ISOLATION As Long = 108
Const SQL_TXN_READ_UNCOMMITTED As Long = &H1&
Const SQL_TXN_READ_COMMITTED As Long = &H2&
Const SQL_TXN_REPEATABLE_READ As Long = &H4&
Const SQL_TXN_SERIALIZABLE As Long = &H8&
Const SQL_TXN_VERSIONING As Long = &H10&
Private Sub Form_Load()
Set en = rdoEngine.rdoEnvironments(0)
Set cn = en.OpenConnection(dsName:="WorkDB", _
Prompt:=rdDriverNoPrompt, _
Connect:="Uid=;pwd=;database=workdb")
rc = SQLSetConnectOption(cn.hDbc, SQL_TXN_ISOLATION, SQL_TXN_READ_UNCOMMITTED)
Debug.Print rc
End Sub