July 2005
Intermediate to advanced
1032 pages
27h 10m
English
In the previous example, I omitted a lot of code that would normally appear in a real-world application. In this section, I'll add some simple error-handling functions and show you how to properly free up the resources (handles) that you create. I'll also use a more complex and more flexible connection function: SQLDriverConnect().
In the previous section, I mentioned that most ODBC functions return two different values to indicate a successful completion: SQL_SUCCESS and SQL_SUCCESS_WITH_INFO. To make your ODBC programming life a little easier, you can use the following function to check for success or failure:
static bool SQL_OK( SQLRETURN result ) { if( result == SQL_SUCCESS || result == SQL_SUCCESS_WITH_INFO ...Read now
Unlock full access