Stored proc not returning values with output parameters 
Author Message
 Stored proc not returning values with output parameters

Hi,

I am having great trouble getting a stored procedure output parameter to
return values to my delphi app. I have searched DejaNews with no success
so assume (hope) I am not reiterating a well worn question - if I am,
could someone please direct me to some help.

The stored procedure is declared thus -




Once compiled, using these commands in ISQLW it works fine





paramtype) from a Delphi app it is either 0 or garbage - it isnt being
set, but the result set is fine. The program is a simple one with no
form, it creates the objects at run time. I've also tried creating a
simple form with TDatabase, TStoredProc, setting the values etc. When

This is the essential code of the program -


...
with TDataBase.Create(Application) do
  try
    DatabaseName := 'Test';
    LoginPrompt := False;
    DriverName := 'MSSQL';
    Params.LoadFromFile('c:\fin130\RSDBParams.TXT');
    Connected := True;
    with TStoredProc.Create(Application) do
      try
        DatabaseName := 'Test';
        StoredProcName := ParamStr(CPROCPARAM);
        with Params do begin

            AsString := ParamStr(CFROMPARAM);

            AsString := ParamStr(CTOPARAM);

        end;
        Open;

        if nBilled > 0 then begin
...

The SQL Statements being sent from the BDE to SQL Server are -

go


go

The main differenct between these and those used in ISQLW is the lack of

wont return a value either.

How do I get this to work? Is their some parameter of the TDatabase
driver that needs to be set for stored procs to return values? I believe
I need to get the BDE to append 'OUTPUT' after the output parameter for
it to work but cant find how to acheive this, I would have thought
declaring the parameter as ptOutput would be all you need. I've tried
using ptInputOutput, assigning a value like the input parameters, using
SQL Server ODBC driver rather than the MSSQL native driver but nothing
changes.

I desperately need this to work. Has anyone had experience with this
problem?? Your help would be gratefully appreciated.

Perry Cornish



Wed, 18 Jun 1902 08:00:00 GMT  
 Stored proc not returning values with output parameters

Delphi's TStoredProc component will return the output parameter only when
you call ExecProc instead of Open method. Open method will return a dataset


FROM  MyTable. MyReturnField will hold that value, and will be the same for
all records in the returned dataset. The problem is you have to make sure
the returned dataset is not empty, otherwise, the value can't be returned.

Quote:

>Hi,

>I am having great trouble getting a stored procedure output parameter to
>return values to my Delphi app. I have searched DejaNews with no success
>so assume (hope) I am not reiterating a well worn question - if I am,
>could someone please direct me to some help.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Returning cursors from Oracle8 stored proc

2. Stored proc, which returns dataset from Oracle

3. does Oracle stored proc return a result set?

4. MS SQL Server stored proc parameter problem

5. Sybase stored procedure with output parameters

6. Problems returning a value from a stored procedure

7. Getting Return Value in Stored Procedures ??

8. FPC: Proc as a parameter

9. Help: TStoredProc component and proc parameters

10. Stored Proc for GRANT ???

11. How to call a stored proc from TQuery??

12. Delphi + stored proc

 

 
Powered by phpBB® Forum Software