// Declare The Local Memory Variables SQLCHAR Field[MAX_ATTRIBUTES][50]; SQLSMALLINT NumCols; // Will be determined with call SQLUINTEGER ArraySize = 4; //unsigned integer // Following determines how many columns exist in results set return_code = SQLNumResultCols(StmtHandle, &NumCols); // Bind The Columns In The Result Data Set Returned To // Application Variables for (int i = 1; i <= (int) NumCols; i++) { return_code = SQLBindCol(StmtHandle, i, SQL_C_CHAR, (SQLPOINTER) Field[i], sizeof(Field[i]), NULL); } // Display A Header cout << "University Relation :" << endl << endl; // While There Are Records In The Result Data Set Generated, // Retrieve And Display Them while (return_code != SQL_NO_DATA) { return_code = SQLFetch(StmtHandle); cout << "Return code from fetch" << return_code; if (return_code != SQL_NO_DATA) cout << University << " " << City << " " << State << " " << Size << endl; } // Return The ODBC API Return Code To The Calling Function return(return_code);