Click to See Complete Forum and Search --> : SQLBindParameter


Mitch Wittneben
April 26th, 1999, 11:11 AM
I am having trouble with the following code (the sp follows). The error (e->m_strError) returns is "COUNT field incorrect". I am not sure what I am doing wrong. Any thoughts would be greatly appreciated.


SQLHSTMT hstmt = SQL_NULL_HSTMT;
RETCODE nRetCode;
long test;
long testlength=sizeof(test);
nRetCode=::SQLBindParameter(hstmt,1,SQL_PARAM_OUTPUT,SQL_C_LONG,SQL_INTEGER,0,0,&test,0,&testlength);
m_App->m_strSQL="{Call spTest(?)}";
try{
m_App->m_Database->ExecuteSQL(m_App->m_strSQL);
}
catch (CDBException* e){
AfxMessageBox(e->m_strError,MB_OK | MB_ICONINFORMATION);
e->Delete();
return;
}

create procedure spTest
@record int output
as
select @record=123456

Lothar Haensler
April 26th, 1999, 12:01 PM
I'd rather override the BindParameters method of the CDatabase object and do the SQLBindParameter there.