[SOLVED] SQLite open database with OpenDialog lazarus / 16-Databases ---------------------------------------------------------------------- Pe3s · 2022-11-27 20:54 Hello, I noticed that when I open one database and want to open another, it does not open. What do I need to fix for the code to work properly? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TfGlowna.SpeedButton2Click(Sender: TObject);begin  if not OpenDialog1.Execute then Exit;   ZConnection1.Database:= OpenDialog1.FileName;  ZConnection1.Connected:= True;   ZQuery1.close;  ZQuery1.SQL.Clear;  ZQuery1.SQL.Text:= 'SELECT * FROM product';  ZQuery1.Open;end; ---------------------------------------------------------------------- dseligo · 2022-11-27 23:33 Just disconnect from database before changing database name. In line 4 add: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZConnection1.Disconnect; // or ZConnection1.Connected := False; ---------------------------------------------------------------------- Pe3s · 2022-11-28 15:53 @dseligo Thank you