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.
Problem with StatementTypes of BeforeUpdateExecute event
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
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
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;
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;