Pls, am having an error code when inserting data into Access database. It keeps saying there's sytank error in my INSERT INTO statement. Can any one help me to solve this.
Here is the code
- try {
- OleDbConnection connection = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\Users\DELL\Documents\EmployeesData.accdb;
- Persist Security Info = false;");
- connection.Open();
- OleDbCommand cmd = new OleDbCommand("insert into EmployeeInfo (UserName, Password)values('" + UserText.Text + "', '" + PassText.Text + "')", connection);
- cmd.ExecuteNonQuery();
- MessageBox.Show("Inserted");
- }
- catch (Exception ex)
- {
- MessageBox.Show("Failed" + ex.ToString());
- }