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=Micr osoft.Jet.OleDb .4.0; Data Source=" + Server.MapPath( "~/app_data/users.mdb"));
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.Co nnection = oleDbConnection ;
oleDbCommand.Co mmandText = "INSERT INTO users (Username, Password)VALUES ('" + TextBox1.Text + "', '" + TextBox2.Text + "')";
oleDbConnection .Open();
oleDbCommand.Ex ecuteNonQuery() ;
oleDbConnection .Close();
I have Using System.Data.Ole Db 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
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=Micr osoft.Jet.OleDb .4.0; Data Source=" + Server.MapPath( "~/app_data/users.mdb"));
OleDbCommand oleDbCommand = new OleDbCommand();
oleDbCommand.Co nnection = oleDbConnection ;
oleDbCommand.Co mmandText = "INSERT INTO users (Username, Password)VALUES ('" + TextBox1.Text + "', '" + TextBox2.Text + "')";
oleDbConnection .Open();
oleDbCommand.Ex ecuteNonQuery() ;
oleDbConnection .Close();
I have Using System.Data.Ole Db 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
Comment