Problem with StatementTypes of BeforeUpdateExecute event

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Balaji
Posts: 20
Joined: Thu 05 Oct 2006 04:45

Problem with StatementTypes of BeforeUpdateExecute event

Post by Balaji » Tue 14 Nov 2006 16:11

Hi,

We have an licenced 3.80.0.32 version of SDAC components.

The StatementTypes value of Query component is returning me stupdate even in the case of insert, delete or update operations in the BeforeUpdateExecute event of Query component.
This problem i am facing specifically when i am obtaining the IdentitKey value from Database.

Can you please help me in knowing and using stInsert, stDelete and stQuery values of StatementTypes in the event.

Thanks in advance.

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

Post by Jackson » Wed 15 Nov 2006 14:09

We couldn't reproduce the problem.
Please send us (evgeniym*crlab*com) a complete small test project to reproduce the problem; it is desirable to use Northwind or Master schema objects, otherwise include definition of your own database objects; don't use third party components

Also supply us following information
- Exact version of Delphi or C++ Builder
- Exact version of SDAC. You can see it in About sheet of TMSConnection Editor
- Exact version of Microsoft SQL Server and OLE DB provider that you use. You can see it in Info sheet of TMSConnection Editor

Japhar
Posts: 38
Joined: Thu 05 Oct 2006 04:22

Post by Japhar » Thu 23 Nov 2006 05:26

Hi,

I too got this problem. But to solve the problem i have modified the code in DBACCESS.pas file of TCustomDAUpdateSQL.ExecSQL procedure.

Core Lab: Can you please let me know the code which i have written is required or it could lead any problem?

procedure TCustomDAUpdateSQL.ExecSQL(UpdateKind: TUpdateKind);
//Added new varibale of type TStatementTypes
var
StatementTypes: TStatementType;
//End adding.
begin

//Commented Core lab code here...Because stUpdate is hardcoded.
// FDataSet.PerformSQL(FSQLText[UpdateKind].Text, [stUpdate]);

//Added below code to set the StatementType according to the UpdateKind.

if (UpdateKind = ukModify) then
begin
StatementTypes := stUpdate;
end Else if (UpdateKind = ukInsert ) then
begin
StatementTypes := stInsert;
end Else if (UpdateKind = ukDelete ) then
begin
StatementTypes := stDelete;
end;

FDataSet.PerformSQL(FSQLText[UpdateKind].Text, [StatementTypes]);

//End Adding.
end;

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

Post by Jackson » Thu 23 Nov 2006 09:23

Thank you for information.
We have reproduced the problem and have fixed it.
This fix will be included in the next SDAC build.
Please watch for announcements at the forum.

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

Post by Jackson » Thu 23 Nov 2006 09:48

Your fix is correct. You can use it as a temporary solution until new build of SDAC is released.

Japhar
Posts: 38
Joined: Thu 05 Oct 2006 04:22

Post by Japhar » Fri 24 Nov 2006 04:55

Thanks for your information..... :D

Post Reply