Access to ODBC and SQL
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Access to ODBC and SQL.
The Microsoft Foundation Class Library encapsulates many Windows API calls and still lets you call any Windows API function directly. The database classes give you the same flexibility with regard to the ODBC API. While the database classes shield you from much of the complexity of ODBC, you can call ODBC API functions directly from anywhere in your program.
Similarly, the database classes shield you from having to work much with SQL, but you can use SQL directly if you want. You can customize recordset objects by passing a custom SQL statement (or setting portions of the default statement) when you open the recordset. You can also make SQL calls directly using the ExecuteSQL member function of class CDatabase.
For more information, see ODBC: Calling ODBC API Functions Directly and SQL: Making Direct SQL Calls (ODBC).