| |

VerySource

 Forgot password?
 Register
Search
View: 1092|Reply: 4

"** No parameter" error when using TADOQuery to connect to the ACCESS database

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-20 20:30:01
| Show all posts |Read mode
"** No default parameters" error when using TADOQuery to connect to the ACCESS database
 I want to query the password field in the username table (with two fields of password and name) in the database username (already bound) in ACCESS.
 In fact, it is the user login interface to see if the passwords match
          ADOQuery1-> Close ();
          ADOQuery1-> SQL-> Clear ();
          ADOQuery1-> SQL-> Text = "select password from username where name =" + Edit2-> Text;
 // I don't know if this sentence is wrong

          ADOQuery1-> Open ();
          AnsiString b = ADOQuery1-> FieldByName ("Password")-> AsString;
 // I use Edit3 to accept the password. How can I compare it with b to determine whether the password is correct or not?
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 Invalid IP Address

Post time: 2020-6-27 09:00:02
| Show all posts
ADOQuery1->FieldByName("Password")->AsString;
select password? case
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-27 11:30:01
| Show all posts
Still not okay
The data in the table is line 210520
My username enter line
It prompts that'line' has no default value
Reply

Use magic Report

0

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-6-28 12:00:01
| Show all posts
It should be wrong in this sentence ADOQuery1->SQL->Text ="select password from username where name=" + Edit2->Text;
If your username is int, then this sentence is correct. If it is not int, you are definitely wrong.
"select password from username where name ='" + Edit2->Text + "'";//Note that I added 2'
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-28 15:00:02
| Show all posts
Thank you very much! The problem is solved!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list