///////////////////
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3,
SQL_IS_INTEGER);
// Allocate a new SQLHDBC. If successful then call SQLConnect using
// the allocated hdbc and supplied connection information.
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
printf("\n\nAttempting SQLConnect() to Northwind \n\n");
rcode = SQLConnect(hdbc, (SQLCHAR*)szDBNameNW, SQL_NTS,
(SQLCHAR*)szUsername, SQL_NTS, (SQLCHAR*)szPassword, SQL_NTS);
printf("Disconnecting from Northwind \n");
SQLDisconnect(hdbc);
printf("\n\nAttempting SQLConnect() to Oracle8i \n\n");
rcode = SQLConnect(hdbc, (SQLCHAR*)szDBNameO8, SQL_NTS,
(SQLCHAR*)szUsername, SQL_NTS, (SQLCHAR*)szPassword, SQL_NTS);
rcode = SQLAllocStmt(hdbc, &hstmt);
if (rcode == SQL_SUCCESS || rcode == SQL_SUCCESS_WITH_INFO)
{
// Retrieve CustomerID from the database to buffer & display;
SQLPrepare(hstmt, (unsigned char*) "SELECT ename FROM emp", SQL_NTS);
SQLExecute(hstmt);
while ( (rcode = SQLFetch(hstmt) ) != SQL_NO_DATA )
{
SQLGetData(hstmt, 1, SQL_C_CHAR, buffer, 50, &sdODataLength);
printf("%s \n", buffer);
}
SQLFreeStmt(hstmt, SQL_DROP);
SQLDisconnect(hdbc);
SQLFreeHandle(SQL_HANDLE_ENV, henv);
2. Help request !
3. Need help on automating DBA task
4. sqlconnect() need help !!
5. myschema - extent size looks very large
6. Oracle 7.3 and Forms 3.0 -- BAD, BAD, BAD!!!
7. What is difference between SQL Anywhere and Sybase System 11?
8. RDO bad, bad, bad
9. Bound Controls: bad,bad,bad
10. RDO bad, bad, bad
11. Geting bad fonts! need help pd7
12. need help bad