Page 1 of 1

Error in working with Stored Procedure Call Generator

Posted: Sun 06 Aug 2006 10:56
by D3lphi
Hi.

I created 5 stored procedures on Northwind database in SQL Server (Look at attachment \SQL folder).

Then I used "Stored Procedure Call Generator" to make their call commands in Delphi. When I try to work with this example, I get this error when trying to Insert/Delete/Update a record:

Image

Sample Application is available here:
http://rapidshare.de/files/28382148/SDA ... 1.rar.html

I'm using Delphi 7 + SP1 installed, SDAC 3.70.3.30, Microsoft SQL Server 08.00.0760
Microsoft SQL Native Client 9.00.1399.06 on Windows XP SP2.

I'm looking forward to hear from you.

Thanks.

Posted: Tue 08 Aug 2006 12:07
by Jackson
If you do not need to know "RETURN_VALUE" parameter value after stored procedure is executed, just remove ":RETURN_VALUE = " from your INSERT, UPDATE, DELETE and REFRESH statements.
If you want to analyze value returned by stored procedure, you have to specify "RETURN_VALUE" parameter type and data type in TCustomDADataSet.BeforeUpdateExecute event.

For example:

Code: Select all

procedure TForm1.MSQuery1BeforeUpdateExecute(Sender: TCustomMSDataSet;
  StatementTypes: TStatementTypes; Params: TMSParams);
begin
  if [stInsert, stUpdate, stDelete, stRefresh] * StatementTypes  [] then begin
    Params.ParamByName('RETURN_VALUE').ParamType := ptResult;
    Params.ParamByName('RETURN_VALUE').DataType := ftInteger;
  end;
end;

Posted: Tue 08 Aug 2006 14:15
by D3lphi
Thanks, It's worked! :D