Error in working with Stored Procedure Call Generator

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
D3lphi
Posts: 2
Joined: Mon 24 Jul 2006 12:39

Error in working with Stored Procedure Call Generator

Post by D3lphi » Sun 06 Aug 2006 10:56

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.

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Tue 08 Aug 2006 12:07

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;

D3lphi
Posts: 2
Joined: Mon 24 Jul 2006 12:39

Post by D3lphi » Tue 08 Aug 2006 14:15

Thanks, It's worked! :D

Post Reply