Answer the question
In order to leave comments, you need to log in
How to fix System.Data.SQLite.SQLiteException: "SQL logic error near "(": syntax error" error?
Hello!
There is the following code for connecting to the database and executing an sql query:
SQLiteConnection connect = new SQLiteConnection("Data source = accounts.db");
connect.Open();
try
{
SQLiteCommand command = new SQLiteCommand($"UPDATE users (Name, Surname) SET ('{NameField.Text}','{SurnameField.Text}') WHERE Login = '{LoginField.Text}'", connect);
command.ExecuteNonQuery();
}
finally
{
MessageBox.Show($"Изменения сохранены!");
connect.Close();
}
System.Data.SQLite.SQLiteException: "SQL logic error
near "(": syntax error"
command.ExecuteNonQuery();
Answer the question
In order to leave comments, you need to log in
Your query syntax is incorrect.
UPDATE is written like this:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question