Showing posts with label perfectly. Show all posts
Showing posts with label perfectly. Show all posts

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

calling stored procedure in VC++

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
Can you provide more complete sample including code for creating stored procedure? Are you sure about syntax "{call user.getpin(?,{resultset 100,pin})}";? Also which line of code throws the exception? BWT RecordCount may be 0 but

rst->Fields->GetItem((short)0)->GetValue();

may still return correct value. Also have you tried PutRefActiveConnection instead? It's difficult to say without more information.

Sunday, March 25, 2012

calling rs.exe from a DTS

Hi everyone,
i'm trying to call a stored procedure that runs rs.exe from a DTS
package,the package works perfectly giving me no errors but when i look at
the results rs.exe has done nothing.
If I call the stored procedure directly it works just fine rendering my pdf
report on filesystem
Anyone has ideas on what is happenning?
Thank YouLnZ wrote:
> Anyone has ideas on what is happenning?
Check the permissions of the account under wich the SQL-ServerAgent-service
is running.
regards
Franksql