Board index » delphi » ADO _Command

ADO _Command

Hi,
   I am trying to get a return value for a stored procedure.I've
declared an output parameter in the stored procedure.Now I try tp
retrieve the output value.It goes like this
Comm : _Command;
ParamArray : olevariant
Re : integer;

     Comm._Set_ActiveConnection(Conn);
     Comm.Set_CommandText('Inserttopic');
     Comm.Set_CommandType(adCmdStoredProc);
     ParamArray := VarArrayOf([TopicName,CommunityID,Re]);
     Comm.Execute(a,ParamArray,0);
     a1 := Comm.Parameters[2].Get_Value;

All I get is waht I pass in Re.Which is the output parameter, though I
am setting it in the stored procedure
How do I get it.
                                  Thank u,
                                     Gold

 

Re:ADO _Command


Quote
Gold <manjus...@vsnl.com> wrote in message news:388C5B67.4269C952@vsnl.com...
> All I get is waht I pass in Re.Which is the output parameter, though I
> am setting it in the stored procedure

I'm not sure if this is the solution, but you might try assigning the return
value of the execute call to a recordset object and then explictly doing a
close.  I know it doesn't really make sense, but I remember reading somewhere
that you need to do this in order to get output parameters in some cases.  So
for your example change it like this:

Comm : _Command;
ParamArray : olevariant
Re : integer;
RS: _Recordset;

     Comm._Set_ActiveConnection(Conn);
     Comm.Set_CommandText('Inserttopic');
     Comm.Set_CommandType(adCmdStoredProc);
     ParamArray := VarArrayOf([TopicName,CommunityID,Re]);
     RS := Comm.Execute(a,ParamArray,0);
     if Assigned(RS) then RS.Close;
     a1 := Comm.Parameters[2].Get_Value;

Hope that helps,

Mark

Other Threads