Answer the question
In order to leave comments, you need to log in
How to check if a user exists in Access database?
DataModule2.ADOQuery1.SQL.Clear;
DataModule2.ADOQuery1.SQL.Add('SELECT Password FROM Users WHERE login ='+#39+Edit1.Text+#39);
DataModule2.ADOQuery1.Open;
if DataModule2.ADOQuery1.IsEmpty then
ShowMessage('Пользователь не найден!')
else
if DataModule2.ADOQuery1.FieldByName('Password').Value <> Edit2.Text then
ShowMessage('Неверный пароль!')
else
begin
Form1.Hide;
Form3.Show;
end;
Answer the question
In order to leave comments, you need to log in
You've generated a lot of questions. Now it is not clear whether you succeeded in inserting the record or not? Judging by this issue, you are inserting something wrong into the database. In my opinion, you have some kind of confusion with apostrophes there. Take a look at the database file with an access! See for yourself what is in this table, most likely not what you expect.
And if you write something like:
DataModule2.ADOQuery1.SQL.Add('SELECT Password FROM Users WHERE login ='+#39+Edit1.Text+#39);
DataModule2.ADOQuery1.Open;
<b>ShowMessage(DataModule2.ADOQuery1.SQL.Text);</b>
if DataModule2.ADOQuery1.IsEmpty then
ShowMessage('Пользователь не найден!')
else
SELECT * FROM table WHERE name LIKE 'Timmi'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question