Hi,
am new to c# so any help here would be greatly appreciated. Am trying to insert into my access database called Users.mdb located in my app data folder. My current code is as follows:
OleDbConnection oleDbConnection = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("~/app_data/users.mdb"));
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.Connection = oleDbConnection;
oleDbCommand.CommandText = "INSERT INTO users (Username, Password)VALUES ('" + TextBox1.Text + "', '" + TextBox2.Text + "')";
oleDbConnection.Open();
oleDbCommand.ExecuteNonQuery();
oleDbConnection.Close();
I have Using System.Data.OleDb at the top of my page class as well, but it returns the following 'Syntax error in INSERT INTO statement'. Am not sure what is wrong, as i am struggling to see anything wrong with the syntax.
Thanks in advance