Using ODBCLink/SE With ODBC Applications | ODBCLink/SE Reference Manual |
If rc <> SQL_SUCCESS Then
MsgBox ("SQLFreeEnv failed rc=" + Str(rc))
Exit Sub
End If
End Sub
Connecting with DAO’s
1.DECLARE YOUR VARIABLES FOR THE CONNECTION
2.SET THE DAO WORKSPACE
3.SET AND OPEN THE CONNECTION TO THE DATABASE
4.SET AND OPEN THE RECORDSET FOR THE TABLE
5.SE THE RECORDSET INFORMATION YOU NEED AND PROCESS IT ACORDINGLY
6.MAKE SURE YOU CLOSE ANY ODJECTS THAT YOU HAVE CREATED WHEN ERRORS OCCUR(OR WHEN EXITING)
1.Dim DAOWS As DAO.Workspace Dim DAORS As DAO.Recordset Dim DAODB As DAO.Database
2.'SET A WORKSPACE ENVIROMENT FOR YOUR CONNECTION 'AND SET THE TYPE TO DBUSEODBC
'Set DAOWS = CreateWorkspace("NewODBCWorkspace", "", "", dbUseODBC)
3.'OPEN THE CONNECTION PASS IN YOU CONNECTION STRING 'Set DAODB = Workspaces(0).OpenDatabase("", dbDriverComplete, True, "ODBC;DSN=YOURDSN;UID=YOURUID;PWD=YOURPASSWORD;")
4.'OPEN THE TABLE AND ENTER THE SQL QUERY
'Set DAORS = DAODB.OpenRecordset("Select * from membership", dbOpenDynaset, dbSQLPassThrough)
5.While Not DAORS.EOF
' Insert your query processing code here. DAORS.MoveNext
Wend
6.‘Close Resultset DAORS.Close
'Close Data Base Connection DAODB.Close
| ODBCLink/SE |
52 | ©M.B. Foster Associates Limited |