Thursday, March 29, 2012

calling stored procedure in VC++

Hi,

dont know whether it is the correct forum.

i have a stored procedure to get the user pin.
the stored procedure works perfectly as i tested it both in VB and ASP,
but when i try to call stored procedure from VC++, then i get a
Idispatch error #3092.
here is the code:

BSTR newpin;
_bstr_t qsql = "{call user.getpin(?,{resultset 100,pin})}";
command->PutActiveConnection(conn);
command->PutCommandText(qsql);
command->Parameters->Refresh();
command->Parameters->Item[_variant_t((short)0)]->Value = userid;
rst = command->Execute(NULL,NULL,adCmdText);
if(rst->RecordCount > 0)
{
newpin = rst->Fields->GetItem((short)0)->GetValue();

}

is there any problem with this code.
thanks

It might be a better bet to expose this issue to the SQL users since they're more likely to have encountered this scenario. Try one of the SQL forums. e.g. http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1

No comments:

Post a Comment