Page 1 of 1

Parameter Not Found

Posted: 13.08.2019, 04:37
by jackylau
Hi,
I found that the same SQL statement with parameter behavior was worked differently between Delphi 10.2 & Delphi 2009.
It works on Delphi 10.2 without any problem, but an exception "Parameter Not Found" was though on Delphi 2009 environment.
The SQL statement is the same, How to fix this?

Background
Zeos 7.2.4-stable
Delphi 2009 and Delphi 10.2

SQL
SELECT * FROM users WHERE username = :username;

Thanks & Regards
Jacky

Re: Parameter Not Found

Posted: 13.08.2019, 10:50
by marsupilami
Hello Jacky,

I split this topic from http://zeoslib.sourceforge.net/viewtopi ... 40&t=49966 because it was a very old thread.

Could you provide a minimum working example that demonstrates the problem? Also a database script and the database you use (MySQL 5.6, Firebird 3.0, ...) would be of great help to reproduce the problem.

Best regards,

Jan

Re: Parameter Not Found

Posted: 13.08.2019, 12:26
by jackylau
Thank you, Jan.
I'm using postgres database (version 8.4 & 11 both not working) and Delphi 2009.

Steps to reproduce
DB Script

Code: Select all

CREATE TABLE sys_users (
  id SERIAL PRIMARY KEY,
  login VARCHAR(50),
  password VARCHAR(50)
);
INSERT INTO sys_users (login, password) VALUES ('TEST', 'TEST');
Delphi 2009
  • Create a delphi 2009 project
  • Place ZConnection component and setup the connection.
  • Place ZQuery component and SQL.Text

    Code: Select all

    SELECT * FROM sys_users WHERE login = :login
Results
Finally, an error was through when set ZQuery.Active = true, and you will find the parameters cannot be added.

Please let me know if any information need to provide would help to resolve the problems, thank you.

Re: Parameter Not Found

Posted: 14.08.2019, 10:32
by jackylau
Suspect the problem may cause by Windows XP environment.
I tried to install Delphi 2009 + Zeoslib 7.2.4-stable in Windows 7, the error cannot reproduce, any idea?

Re: Parameter Not Found

Posted: 14.08.2019, 20:14
by miab3

Code: Select all

procedure TForm2.btn1Click(Sender: TObject);
begin
ZQuery1.ParamByName('login').AsString:='MYlogin';
ZQuery1.Open;
end;
Michal

Re: Parameter Not Found

Posted: 15.08.2019, 06:32
by jackylau
Hi Michal,
Your code is correct, but it didn't help to solve the problem.
Because the problem is while using "Windows XP" + Delphi 2009 + Zeoslib 7.2.4-stable environment, a syntax error caused the Params object couldn't be added correctly.
The same way in "Winsows 7" + Delphi 2009 + Zeoslib 7.2.4-stable environment works.
Attached two screen capture for your reference to compare the differences (highlighted in red).

Thanks & Regards
Jacky

Re: Parameter Not Found

Posted: 15.08.2019, 13:39
by marsupilami
Hello Jacky,

could you please try if the current 7.2-fixes branch from SVN solves your problem? I seem to remember a similar problem was solved for a different user in the past.

Best regards,

Jan

Re: Parameter Not Found

Posted: 16.08.2019, 06:20
by jackylau
Hi Jan,
I'm not sure am I using the right branch to test [https://sourceforge.net/p/zeoslib/code- ... 2-patches/], the version is 7.2.5-rc.
If yes, the problem still exists.
The similar issue might be this thread http://zeoslib.sourceforge.net/viewtopi ... 40&t=49966 ?
I found that this issue quite specifies happen on Windows XP environment. Because I've tried Windows 7 + Delphi 2009 + Zeos 7.2.4 without problems, but unfortunately the existing project only can run on Windows XP + Delphi 2009 (Currently using 7.0.0-dev also no problem found)

Thanks & Regards
Jacky

Re: Parameter Not Found

Posted: 19.08.2019, 12:10
by marsupilami
Hello Jacky,

to see wether this really is a problem of Windows XP, could you try to compile the program on Windows 7 and see if that compiled program works correctly on Windows XP?

Best regards,

Jan