Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2026-10

Params disappear from SQLQuery

4 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

It's been years since I made a database-application. I just started one but I have a problem with my query. I'm trying to add Params but when I close the project and reopen it, those Params are gone. What I did to test this :
Create a project (application)
Add a TSQLite3Connection
Add a TSQLTransaction
Add a TSQLQuery
Connect the SQLquery to the SQLIte3Connection
Connect the SQLTransaction to the SQLIte3Connection Create two params for the SQLQuery :
click on the elipsis (...) of Params
click on Add
change the name of the param : param1
click on Add
change the name of the param : param2

save the project
close the project
reopen the project
checking the SQLQuery : the params are gone.
Am I doing something wrong ? Or a bug ?

Maybe related : I can't use the params when running the application (without closing the project). In my application I added this in OnCreate of the form :

   SQLQuery1.Active:=true;
   showmessage(IntToStr(SQLQuery1.Params.Count));

This shows '0', so Params are gone there also ?
Closing the application still shows the Params in the Lazarus GUI.

In Lazarus 'Help' shows : lazarus v4.2, fpc v3.2.2 (built for QT5 with fpcupdeluxe).
Lazarus running on Kubuntu 24.04

TIA
Koenraad

Reply by email

John Landmesser
to Koenraad Lelong

I use ZEOSDBO from online Package manager , that? works perfectly

Good luck

JohnML

Koenraad Lelong wrote 40 lines
Hi, It's been years since I made a database-application. I just started one but I have a problem with my query. I'm trying to add Params but when I close the project and reopen it, those Params are gone. What I did to test this : Create a project (application) Add a TSQLite3Connection Add a TSQLTransaction Add a TSQLQuery Connect the SQLquery to the SQLIte3Connection Connect the SQLTransaction to the SQLIte3Connection Create two params for the SQLQuery : ?click on the elipsis (...) of Params ? click on Add ? change the name of the param : param1 ? click on Add ? change the name of the param : param2 save the project close the project reopen the project checking the SQLQuery : the params are gone. Am I doing something wrong ? Or a bug ? Maybe related : I can't use the params when running the application (without closing the project). In my application I added this in OnCreate of the form : ? SQLQuery1.Active:=true; ? showmessage(IntToStr(SQLQuery1.Params.Count)); This shows '0', so Params are gone there also ? Closing the application still shows the Params in the Lazarus GUI. In Lazarus 'Help' shows? : lazarus v4.2, fpc v3.2.2 (built for QT5 with fpcupdeluxe). Lazarus running on Kubuntu 24.04 TIA Koenraad

Reply by email

Carlos Gonzaga
to John Landmesser

It works fine here with SQLdb.

If your query isn't parameterized, it won't look for parameters!

Em sex., 9 de out. de 2026 ?s 15:48, John Landmesser via lazarus <

Show quoted text 55 lines
escreveu: I use ZEOSDBO from online Package manager , that works perfectly Good luck JohnML Am 09.10.26 um 17:55 schrieb Koenraad Lelong via lazarus: > Hi, > > It's been years since I made a database-application. > I just started one but I have a problem with my query. I'm trying to > add Params but when I close the project and reopen it, those Params > are gone. > What I did to test this : > Create a project (application) > Add a TSQLite3Connection > Add a TSQLTransaction > Add a TSQLQuery > Connect the SQLquery to the SQLIte3Connection > Connect the SQLTransaction to the SQLIte3Connection > Create two params for the SQLQuery : > click on the elipsis (...) of Params > click on Add > change the name of the param : param1 > click on Add > change the name of the param : param2 > > save the project > close the project > reopen the project > checking the SQLQuery : the params are gone. > Am I doing something wrong ? Or a bug ? > > Maybe related : I can't use the params when running the application > (without closing the project). In my application I added this in > OnCreate of the form : > SQLQuery1.Active:=true; > showmessage(IntToStr(SQLQuery1.Params.Count)); > This shows '0', so Params are gone there also ? > Closing the application still shows the Params in the Lazarus GUI. > > In Lazarus 'Help' shows : lazarus v4.2, fpc v3.2.2 (built for QT5 > with fpcupdeluxe). > Lazarus running on Kubuntu 24.04 > > TIA > Koenraad -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus
Carlos Gonzaga -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20261009/2b3ddc5f/attachment.htm>

Reply by email

Michael Van Canneyt
to Koenraad Lelong: It's been years since I made a database-application. I just started one but I have a…
Koenraad Lelong wrote 24 lines
Hi, It's been years since I made a database-application. I just started one but I have a problem with my query. I'm trying to add Params but when I close the project and reopen it, those Params are gone. What I did to test this : Create a project (application) Add a TSQLite3Connection Add a TSQLTransaction Add a TSQLQuery Connect the SQLquery to the SQLIte3Connection Connect the SQLTransaction to the SQLIte3Connection Create two params for the SQLQuery : click on the elipsis (...) of Params click on Add change the name of the param : param1 click on Add change the name of the param : param2 save the project close the project reopen the project checking the SQLQuery : the params are gone. Am I doing something wrong ? Or a bug ?

You should never add params by yourself.

The params are determined from the SQL statement.

You must only set the value in the object inspector after you set the SQL statement: the TSQLQuery component will have created the parameters for you, and you can set their values.

If you left the SQL empty, then it is normal that saving & reloading removed them: the SQL statement (because it is empty) does not contain any parameters.

Michael.

Reply by email