Lazarus 0.9.30.2 How to destroy a dynamically created TMySQL51Connection? ERROR lazarus / 16-Databases ---------------------------------------------------------------------- lazguy · 2012-02-03 01:21 Hello everybody !!!!!!!  new doubts  ;-) On Lazarus 0.9.30 (Windows 7) and TMySQL50Connection I have the code (and it works): Code: [Select]    try       ConCli := TMySQL50Connection.Create(nil);       ConCli.HostName := ipHost;       ConCli.port := 3306;       ConCli.UserName := username;       ConCli.Password := password;       ConCli.DatabaseName := databasename;       TranCli := TSQLTransaction.Create(nil);       TranCli.DataBase := ConCli;       QryCli := TSQLQuery.Create(nil);       QryCli.DataBase := ConCli;       QryCli.Transaction := TranCli;       try         ConCli.Open;       except         on e : exception do         begin           if (e.Message='Server connect failed.') then           begin             MessageDlg('Error',                 'Could not connect server.',mtError,                  [mbCancel],0);             exit;           end;         end;       end;         ...     Code here     ...       finally       QryCli.Close;       ConCli.Close;       QryCli.Free;       TranCli.Free;       ConCli.Free;     end; When I use the same code on Lazarus 0.9.30.2 with TMySQL51Connection I have the following error at the line TranCli.Free; Debugger Exception Notification   Project Controle de Processos raised exception class 'EDatabaseError' with message Operation cannot be performed on an active transaction How to solve this ? Thank you very much in advance. ---------------------------------------------------------------------- lazguy · 2012-02-08 01:35 Well, I returned to Lazarus 0.9.30, but i don't know why i am having the same error. I found the site  http://mantis.freepascal.org/view.php?id=18841     I applied the patch, but the error message continues. So, after some tries, i discovered that if i use the method freeinstance on both the transaction and the connection i don't have the error and seems that the problem was solved. So I ask: Can I use freeinstance instead of free ? ---------------------------------------------------------------------- ludob · 2012-02-08 09:30 The problem reported on mantis was caused by TSQLTransaction.Destroy calling rollback which returned always false for mysql. Have you tried 'TranCli.commit;' before calling 'TranCli.Free;'? Freeinstance should never be called directly. It is like pulling the plug on your computer to shut it down. ---------------------------------------------------------------------- lazguy · 2012-02-14 14:32 Hi ludob, excuse me for the delay, the lazarus forum was off-line the last time i came here. Well, I tried the commit without success. Please, do you know what can i do ? Can anyone help me ? Thank you very much in advance. I am posting a doubt about this on de generic topic asking how to completely remove Lazarus. I will try to go back to the previous version.