N
N
NikitaPythonGO2018-03-09 16:47:38
Delphi
NikitaPythonGO, 2018-03-09 16:47:38

How to add data to an Access database?

I'm trying to add a new user to the database in the following way:

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

But it gives the error "...Syntax error (operator missing) in query expression"
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

2 answer(s)
A
Artyom Karetnikov, 2018-03-10
@art_karetnikov

Good. Well, there's nothing to think about. Actually a syntax error, most likely with '
Take this all 'INSERT INTO Users (login,password) VALUES ('''+Edit1.Text+''', '''+Edit2.Text+''')');
DataModule2.ADOQuery1.ExecSQL;
Drive it into a text variable along with the data, you'll see for yourself. If you don't see it, display it in Management Studio

K
Konstantin Tsvetkov, 2018-03-09
@tsklab

Can count first:

now the error is "syntax error of insert into statement"
Check the query text (SQL.Text) either with a debugger or ShowMessage.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question