Parameter Not Found
Parameter Not Found
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
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
-
- Platinum Boarder
- Posts: 1999
- Joined: 17.01.2011, 14:17
Re: Parameter Not Found
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
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
Thank you, Jan.
I'm using postgres database (version 8.4 & 11 both not working) and Delphi 2009.
Steps to reproduce
DB Script
Delphi 2009
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.
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');
- 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
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.
You do not have the required permissions to view the files attached to this post.
Re: Parameter Not Found
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?
I tried to install Delphi 2009 + Zeoslib 7.2.4-stable in Windows 7, the error cannot reproduce, any idea?
Re: Parameter Not Found
Code: Select all
procedure TForm2.btn1Click(Sender: TObject);
begin
ZQuery1.ParamByName('login').AsString:='MYlogin';
ZQuery1.Open;
end;
Re: Parameter Not Found
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
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
You do not have the required permissions to view the files attached to this post.
-
- Platinum Boarder
- Posts: 1999
- Joined: 17.01.2011, 14:17
Re: Parameter Not Found
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
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
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
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
-
- Platinum Boarder
- Posts: 1999
- Joined: 17.01.2011, 14:17
Re: Parameter Not Found
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
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