hallo
Iam trying to insert a row into a access database using visual c# and iam getting an error " cannot open the action query". here is my code
any idea why is this error ?
Thank you.
Dinesh.
Iam trying to insert a row into a access database using visual c# and iam getting an error " cannot open the action query". here is my code
Code:
private void button1_Click(object sender, EventArgs e) { txt1 = textBox1.Text; txt2 = textBox2.Text; String connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Userinfo.accdb"; OleDbConnection connection = new OleDbConnection(connectionString); OleDbCommand command = new OleDbCommand(); command.CommandType = CommandType.TableDirect; command.CommandText = "INSERT INTO userinfo (Username, Pwd) VALUES (‘" + txt1 + "’ , ‘" + txt2 + "’)"; command.Connection = connection; connection.Open(); command.ExecuteNonQuery(); // getting in this line . connection.Close();
Thank you.
Dinesh.
Comment