C
coolbee
Unregistered / Unconfirmed
GUEST, unregistred user!
if not DBEngine.Query.SQLConnection.InTransaction then
begin
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
DBEngine.Query.SQLConnection.StartTransaction(TD);
try
DBEngine.Query.Close;
DBEngine.Query.SQL.Text :=
'INSERT INTO Dealing (Dealing_ID)SELECT MAX(Dealing_ID)+1 FROM Dealing';
DBEngine.Query.ExecSQL();
DBEngine.Query.Close;
DBEngine.Query.SQL.Text :='SELECT MAX(Dealing_ID) AS Dealing_ID FROM Dealing';
DBEngine.Query.Open;
if not DBEngine.Query.IsEmpty then
begin
DealingID := DBEngine.Query.FieldByName('Dealing_ID').AsInteger;
end;
DBEngine.Query.SQLConnection.Commit(TD);《---Commands out of sync now?
finally
DBEngine.Query.SQLConnection.Rollback(TD);
end;
end;
begin
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
DBEngine.Query.SQLConnection.StartTransaction(TD);
try
DBEngine.Query.Close;
DBEngine.Query.SQL.Text :=
'INSERT INTO Dealing (Dealing_ID)SELECT MAX(Dealing_ID)+1 FROM Dealing';
DBEngine.Query.ExecSQL();
DBEngine.Query.Close;
DBEngine.Query.SQL.Text :='SELECT MAX(Dealing_ID) AS Dealing_ID FROM Dealing';
DBEngine.Query.Open;
if not DBEngine.Query.IsEmpty then
begin
DealingID := DBEngine.Query.FieldByName('Dealing_ID').AsInteger;
end;
DBEngine.Query.SQLConnection.Commit(TD);《---Commands out of sync now?
finally
DBEngine.Query.SQLConnection.Rollback(TD);
end;
end;