RATE THIS ANSWER
0
Click to Vote:
0
0
Here is an example, using ODBC, and functions from sql.h
SQLHENV henv;
SQLHDBC hdbc;
SQLRETURN rc;
SQLCHAR server[12];
SQLCHAR uid[12];
SQLCHAR pwd[12];
.
.
.
strcpy((char*)server, "test_db");
strcpy((char*)uid, "Admin");
strcpy((char*)pwd, "");
SDWORD cbName = SQL_NTS;
if (((rc = SQLAllocEnv(&henv)) == SQL_SUCCESS) &&
((rc = SQLAllocConnect(henv, &hdbc)) == SQL_SUCCESS))
{
if ((rc = SQLConnect(hdbc, server, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)) != SQL_SUCCESS)
print_error (henv, hdbc, SQL_NULL_HSTMT, rc, __LINE__, __FILE__);
}
else
{
print_error (henv, SQL_NULL_HDBC, SQL_NULL_HSTMT, rc, __LINE__, __FILE__);
}
Have a look at this MSDN document:
Developing Access 2007 Solutions with Native C or C++
Last Answered:
Mar 4 2009 2:17 PM GMT by Carlosdl 
29340 pts.