my database in MS Access.i have a table named Admin.It has two attributes Username and Password. when i use insert query for inserting data then it show a message"syntax error in INSERT INTO statement." but i could not find out the problem . please help my code-
string cb = "INSERT INTO Admin(Username,Password) VALUES (@d1,@d2)";
command = new OleDbCommand(cb);
command.Connection = connection;
command.Parameters.Add(new OleDbParameter("@d1", System.Data.OleDb.OleDbType.VarChar, 20, "Username"));
command.Parameters.Add(new OleDbParameter("@d2", System.Data.OleDb.OleDbType.VarChar, 30, "Password"));
command.Parameters["@d1"].Value = textusername.Text;
command.Parameters["@d2"].Value = textpassword.Text;
command.ExecuteNonQuery();
MessageBox.Show("Successfully saved", "Student Details", MessageBoxButtons.OK, MessageBoxIcon.Information);
Add.Enabled = true;
if (connection.State == ConnectionState.Open)
{
connection.Close();
}
connection.Close();