May 19, 2005 at 2:20 pm
I have an aplication written in VC 6.0 that uses ODBC API 3.0 with connection pooling activated. I execute a STATEMENTlike this
pStatement = (SQLCHAR *) "{call MyProc(?,?)}";
rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, lstrlen(pParam1)+1, 0,pParam1, 0, &cbNTS);
if(!MYSQLSUCCESS(rc)){error_out(0,0,hstmt);return false;}
rc = SQLBindParameter(hstmt, 2, SQL_PARAM_OUTPUT, SQL_C_SLONG ,SQL_INTEGER, 4, 0, &i_NoOfRows, 4, &ii_NoOfRows);
if(!MYSQLSUCCESS(rc)){error_out(0,0,hstmt);return false;}
rc = SQLPrepare(hstmt,pStatement,strlen((char*) pStatement));
if(!MYSQLSUCCESS(rc)) {error_out(0,0,hstmt);return false;}
rc = SQLExecute(hstmt);
...
The i_NoOfRows should contain the result from SP (wich is tested with Querry analyzer and IS there and is good) but when I run the program the value is 0 all the time.
After some research I figured out that this happens because the connection is released to connections pool and everything regarding the connection is cleared.
The problem is that I release the connection AFTER I save this variable but still 0. If I don't release the connection the value is retrieved in the right way with the right value. I don't understand what I m missing since I release the connection only AFTER I save the variable.
Any help would be appreciated
Vasc
May 20, 2005 at 6:55 am
try or adapt this:
pStatement = "{?=call MyProc(?)}";
//return value parameter
rc = SQLBindParameter(hstmt, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER,
11, 0, (void*)&m_lDbOutParam, 0, &m_lBufLength);
//1st parameter value
rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT,...
May 20, 2005 at 8:45 am
Actually in real code I m returning more than 1 value.
But like it happens ... something changed and the code suddenly works ... I can't figure out what it is
before the sp_resetconnection was executing before the RPC completed event and now is executing fine (after this event).
Is there any param that can affect this ?
Vasc
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply