I'm using CRecordset to call stored procedures.
If the stored procedure takes only IN parameters and returns a record set,
that's OK. But one of my stored procedures has OUT parameters, and I cannot
get the result from the bound variable.
My stored procedure looks like this (Sybase syntax):
PROCEDURE proc_name(IN p1 INT, OUT p2 INT)
RESULT ( "XXX" INT, "YYY" INT)
BEGIN
......;
END
The stored procedure is correct. I've tested it using Java.
Here's what I do in my program:
In my record set class (derived from CRecordset), I define two field
variables (for XXX and YYY), and two param variables (for p1, and p2). In
its constructor, I initialize these variables as well as m_nFields, and
m_nParams.
In the DoFieldExchange virtual function, I add the following (I do not copy
the ClassWizard generated code here):
pFX->SetFieldType(CFieldExchange::inputParam);
RFX_INT(pFX, "p1", m_p1);
pFX->SetFieldType(CFieldExchange::outputParam);
RFX_INT(pFX, "p2", m_p2);
Then I open the recordset by passing the string: "{CALL proc_name(?, ?)}", I
think the m_p2 variable should now contain the result, but it doesn't!
What's wrong with my method? Your reply'd be greatly appreciated!
Thanks in advance!
Lei
George
http://home.att.net/~gpoulose
Lei Hu <lei...@cmis.csiro.au> wrote in message news:u7Nfl40K$GA....@cppssbbsa02.microsoft.com...
pFX->SetFieldType(CFieldExchange::outputParam);
to:
pFX->SetFieldType(CFieldExchange::inoutParam);
George
http://home.att.net/~gpoulose/
I've tried both (using combination of RFX_LONG and
CFieldExchange::inoutParam), but it didn't work.
I'm afraid I missed something in my program...
Can anybody please help?
Thanks!
Lei
George Poulose <GPou...@att.net> wrote in message
news:ett0BA1K$GA.249@cppssbbsa04...
> Also, you may want to try changing
> RFX_INT to RFX_LONG
>
> George
> http://home.att.net/~gpoulose
>
>
http://support.microsoft.com/support/kb/articles/Q183/0/01.ASP
George
http://home.att.net/~gpoulose/
Lei Hu <lei...@cmis.csiro.au> wrote in message news:OtOBSh3K$GA.55@cppssbbsa05...