in ODBC API the order of calling is
1. Alloc a workspace, use SQLAllocWorkspace/SQLAllocHandle.
MFC has a wraper for it(as I believe) CWorkSpace or CODBCWorkSpace.
2. Using this handle alloc a connection using SQLAllocConnect or SQLAllocHandle.
MFC wrapper -- CDBConnection(also in my opinion)
3. Connect, using SQLConnect or SQLDriverConnect. The last one is much better.
4. Alloc a statement with SQLAllocStmt or SQLAllocHandle.
I think there should exist a wriper, something about CDBRecordSet or CSqlStatement. My advice, is to consult MSDC if you use MFC.
4.1 If you need the results, bind columns using SQLBindColumn.
5. execute, using SQLExecute or SQLExecDirect.
5.1 use SQLFetch to get each record.
6. free the statement handle using SQLFreeStmt or SQLFreeHandle
7. Disconnect from the database using SQLDisconnect
8. Free the connection.
9. Free the workspace John Fill
ivfmd@mail.md