Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ODBC SQLBindParameter: Output parameter for stored procedure not supported?

0 views
Skip to first unread message

James Wong

unread,
May 27, 1999, 3:00:00 AM5/27/99
to
Hello all,

I have an ODBC client application using that calls a stored procedure that
returns a status.
I simply bind the parameter such as:

strcpy (szSQLStmt, "? = EXEC my_proc ?,?);
SQLBindParameter(hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_LONG,
SQL_INTEGER, 0, 0, &iRetVal, 0, &cbRetVal);
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_CHAR, MAX_LEN, 0, szTxt1, 0, &cbTxt1);
SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_CHAR, MAX_LEN, 0, szTxt2, 0, &cbTxt2);

And then execute the statement using SQLExecDirect
exec_res = SQLExecDirect (hstmt, szSQLStmt, SQL_NTS);

In the ODBC 2.x environment, iRetVal returns the correct status from the
stored procedure.
But in the ODBC 3.x environment, iRetVal never gets set to anything.
I read in the SQL Server Books Online that in order to use SQL_PARAM_OUTPUT,
I have to use the 'OUTPUT' keyword in my stored procedure. But another book
said that SQL_PARAM_OUTPUT is no longer supported for ODBC 3.x and I should
use the SQL_RETURN_VALUE (which I tried and did not work)

My question is: What do I need to do in my program in order for
SQLExecDirect to return the correct iRetVal?
Is it true that SQL_PARAM_OUTPUT is no longer supported for ODBC 3.x? What
are my alternatives?

I set the ODBC environment using SQLSetEnvAttr, the ODBC version we are
using is 3.60 and the application talks to SQL Server 6.5.

Thanks in advance!

Jamester


0 new messages