Delphi 10.4 / TZQuery with TZUpdateSQL and TDataSource:
Whenever the user updates a row it results in the following error:
"Bind message supplies 0 parameters, but prepared statement requires 32"
I was able to trace it down to ZSQLStrings.pas in Rev 7490 - my code works with Rev 7489.
Diff:
Hello Ralph,
Can you please add more details or an example? My crystal ball is silent yet (no offence).
It's related to TZUpdateSQL but more i can't figure out, sorry. What are you doing?
Regards, Michael
Hello Michael,
yes of course... these crystal balls are hard to get!
The user can edit data and eventually hits "Save". The new data is written to the database:
dmDatabase is a DataModule that holds pretty much all the DataSets, Queries and UpdateSQLs. For (almost) every Query there is an UpdateSQL with the SQL-Lines for "Delete", "Insert" and "Modify". An example for modifying would be:
The last 22 years it worked that way, r7490 causes the UpdateSQL to fail with missing parameters, as I would call it.
There where changes in ZSQLStrings.pas in r7490 that dealt with params as far as I can tell. But the line that clears the params in ZSQLStrings.pas just moved up or down just a few lines in the source - I can't see the cause for this error.
Regards, Ralph
Last edit: Ralph Staudte 2021-05-04
Please don't waste too much time with this bug.
I am getting rid of all the UpdateSQLs since all I am doing with it can be done within QueryBeforePost - for example. And I am pretty sure that they will be gone completely by the end of this week.
I was using UpdateSQLs since when I was starting to code my main-application back in 1999 / 2000. I probably didn't know better back then but now I actually think I don't need them anymore.
Thanks so much for the work on Zeos!!
Ralph
Ralph, if you run into an issue, i made, others will run into same trap, propably.
Yet i can't reproduce it. just commited a logic fix: r7529
Steps i've done:
Add a TZTable to a Formular.
Add a TZUpdateSQL to the formular and link it with tztable.
Generate the SQL's.
Run the appclication with and without persistent Parameters of the TZUpdateSQL component.
Both do work. Wondering...
What's the creation order of the two related components ? Which one is the first in the DFM/LFM file?
Hi Michael,
I left one UpdateSQL in the sources just for you ;-)
You've checked the combination of TZTable and TZUpdateSQL - but in my case it's TZQuery with TZUpdateSQL. Just in case it matters...
Here is the needed part of the dfm, I hope it helps:
Hi Michael,
things are getting strange:
I just found another UpdateSQL outside my DataModule. ****And this one works!
Things that are different - the ones I found - are:
Here is the part of the dfm:
Last edit: Ralph Staudte 2021-05-06
Hello Ralph,
could you please try to create a small sample application that demonstrates the problem? It only needs to be a form with a button that will do the necessary calls. Also a create script for the database would be good. Otherwise it will get really hard to debug the problem.
Best regards,
Jan
I confirm that there is a huge oddity here. I was doing a simple project where I used TZUpdateSQL, TZQuery and TZConnection. I put them in one DataModule. When adding a record I get the error:
"Bind message supplies 0 parameters, but prepared statement requires 8"
And once I moved TZConnection to another DataModule, everything worked for me. The error disappeared and records began to be added
I am using Embarcadero® Delphi® 2010 Version 14.0.3593.25826
Zeos: 8.0.0-stable build at 2024-04-07 12:29:02
Last edit: Artyom 2025-02-06