SQL Statements Entered by the User
SQLSMALLINT i, MsgLen;
SQLINTEGER NativeError;
SQLRETURN rc1, rc2;
// Prompt user for SQL statement.
GetSQLStatement(Statement);
// Execute the statement directly. Because it will only be executed once, do
not
// prepare it.
rc1 = SQLExecDirect(hstmt, Statement, SQL_NTS);
// Process any errors or returned information.
if ((rc1 == SQL_ERROR) || rc1 == SQL_SUCCESS_WITH_INFO) {
i = 1;
while ((rc2 = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState,
&NativeError,
Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) {
DisplayError(SqlState, NativeError, Msg, MsgLen);
i++;
}
}