D
D
DimaDel2018-03-09 18:29:21
Delphi
DimaDel, 2018-03-09 18:29:21

How to fix an error while working with Access?

The code:

DataModule2.ADOQuery1.SQL.Clear; 
DataModule2.ADOQuery1.SQL.Add('INSERT INTO Users ([login],[password]) VALUES ('+Edit1.Text+', '+Edit2.Text+')'); 
DataModule2.ADOQuery1.ExecSQL; 
ShowMessage('Успешно');

Error: "Insert into statement syntax error"
What's wrong?
The table itself has 3 fields: code, login, password

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2018-03-10
@DimaDel

DataModule2.ADOQuery1.SQL.Add('INSERT INTO Users ([login],[password]) VALUES ("'+Edit1.Text+'", "'+Edit2.Text+'")');
The text in the query must be escaped in quotation marks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question