Can someone tell me why I keep loosing connection to the database?

procedure TForm3.ThisCommand1Click(Sender: TObject);
begin
    datamodule2.IBSQL1.SQL.Clear;
    
datamodule2.IBSQL1.SQL.Add(datamodule2.IBTable2.FieldByName('commands_').AsString+';');
    if datamodule2.IBSQL1.Transaction.Active = true then
    begin
        datamodule2.IBSQL1.Transaction.Rollback;
    end;
    datamodule2.IBSQL1.Transaction.StartTransaction;
    datamodule2.IBSQL1.Prepare;
    if (datamodule2.IBSQL1.Prepared = true) then
    begin
        datamodule2.IBSQL1.ExecQuery;
        datamodule2.IBSQL1.Transaction.CommitRetaining;
        // I've also tried: datamodule2.IBSQL1.Transaction.CommitRetaining;
        // I lose the connection to the database on either
    end;
end;


Reply via email to