Page 1 of 1

Problem with identity fields in SDAC 4.X ver. prof.

Posted: Sat 31 Mar 2007 15:26
by Sergio Bertolotti
Dear support,

I precedently use SDAC 3.x with Microsoft SQL Express 2005 in italian with service pack 2 and Borland Delphi 7 ver. professional.
I note this problem.
With SDAC 3.x if I have a table with an identity field, for example :

CREATE TABLE [dbo].[sergio] (
[CONTA] int IDENTITY(1, 1) NOT NULL,
[DEMO] varchar(30) COLLATE Latin1_General_CI_AS,
CONSTRAINT [sergio_pk] PRIMARY KEY CLUSTERED ([CONTA]),
UNIQUE ([CONTA])
)
ON [PRIMARY]

when I generate SQL insert in my TMSQuery I obtain the following
statement :

INSERT INTO sergio
(DEMO)
VALUES
(:DEMO)
SET :CONTA = SCOPE_IDENTITY()

Then I use TCustomDADataSet.BeforeUpdateExecute event to set parameter type to ptInputOutput in my insert statement.

For example:
procedure TForm1.MSQuery1BeforeUpdateExecute(Sender: TCustomMSDataSet;
StatementTypes: TStatementTypes; Params: TMSParams);
begin
if stInsert in StatementTypes then
Params.ParamByName('CONTA').ParamType := ptInputOutput;
end;

and to set property TCustomDADataSet.Options.ReturnParams to True.

Now, with SDAC 4.x when I generate SQL Insert I obtain :

INSERT INTO sergio
(DEMO)
VALUES
(:DEMO)

without SET :CONTA = SCOPE_IDENTITY(), and I can't retrieve value for field conta with MSQuery1BeforeUpdateExecute.

There is a new option/method for doing/obtain this value or this is a bug ?

Best regards.
Sergio B.

Posted: Mon 02 Apr 2007 11:27
by Jackson
Thank you for information.
We have reproduced the problem and fixed it.
This fix will be included in the next build of SDAC 4.

Posted: Mon 02 Apr 2007 11:34
by Sergio Bertolotti
Dear EvgeniyM,

many thank's for your interesting.

I use in many points of my code this method for retrieving data in input.

When do you plan to releas this update to SDAC 4 ?

Best regards.
Sergio B.

Posted: Mon 02 Apr 2007 12:00
by Jackson
New build of SDAC 4 will be available in about one week.