0

I have an MDB file I access using OleDB:

OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Database.mdb;Persist Security Info=True");

And try to create a new row in a table Users:

connection.Open();
OleDbCommand cmd = new OleDbCommand("INSERT INTO `users` (`name`, `password`) VALUES ('asd', 'asd')", connection);
cmd.ExecuteNonQuery();
connection.Close();

But nothing happens. I don't get an error message or exceptions, it runs without problems. But when I check the database after the program finished, the table still is empty.

(I already tried the same using DataSets and TableAdapters, but the same happened there: Inserting not committed to database)

1 Answer 1

1

That query does not look like an Access query. Have you tried:

"INSERT INTO [users] ([name], [password]) VALUES ('asd', 'asd')"

In Access, table and field names do not use a back-quote, however, reserved words must be enclosed in square brackets.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.