ODBC Problem (SQLBindParameter ???)
Posted in 1998
Hi , I have a simple 'C' program which executes a procedure which returns a datetime value . Apparently , I am not getting any returned value. Can someone enlighten me ? Could be , I am missing something obvious. ( I am fairly new to CLI) I have enclosed a portion of the relevant code: CHAR parm_o1[250]= ""; SDWORD cb_o1; char stmt_exec[] = "{ ?=call proc_test () }"; char sqlState[20]; SDWORD nativeError; char errorMessage[500]; SWORD cbErrorMessage; rc = SQLAllocStmt (hdbc, &hstmt2); printf("Preparing the call statement.\\n"); rc = SQLPrepare(hstmt2, stmt_exec, SQL_NTS); if (rc != SQL_SUCCESS) { SQLError(Env, hdbc, hstmt2, sqlState, &nativeError, errorMessage, sizeof(errorMessage), &cbErrorMessage); printf("Error code %d, %s\\n", nativeError, errorMessage); if (rc != SQL_SUCCESS_WITH_INFO) { exit(0); } } rc = SQLBindParameter (hstmt2, 1, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_TIMESTAMP, 19, 0, parm_o1,sizeof(parm_o1),&cb_o1); if (rc != SQL_SUCCESS) { SQLError(Env, hdbc, hstmt2, sqlState, &nativeError, errorMessage, sizeof(errorMessage), &cbErrorMessage); printf("Error code %d, %s\\n", nativeError, errorMessage); if (rc != SQL_SUCCESS_WITH_INFO) { exit(0); } } printf("Executing the procedure call.\\n"); rc = SQLExecute(hstmt2); if (rc != SQL_SUCCESS) { SQLError(Env, hdbc, hstmt2, sqlState, &nativeError, errorMessage, sizeof(errorMessage), &cbErrorMessage); printf("Error code %d, %s\\n", nativeError, errorMessage); if (rc != SQL_SUCCESS_WITH_INFO) { exit(0); } } printf ("The value is %s \\n", parm_o1); } ========================================= Madan Mashalkar madan@infogain.com =========================================