I am getting an error while inserting data.
The error is "Number of query values and destination fields are not the same".
I have read alot about ppl missing some single qoutes but I must be overlooking them.
My code :
private void btn_Insert_Click(object sender, EventArgs e)
{
con.Open();
OleDbCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into Table values('" + txt_Date + "','" + txt_Units + "','" + txt_TimeOrd + "','" + txtTimeRec + "','" + txt_Panel + "', '" + txt_Box +"','" + txt_Name + "', '" + txt_Notes +"')";
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record inserted Successfully");
}
}
}
Ankit SahuPosted Oct 23, 2017, 12:26 PM
james jamesPosted Oct 22, 2017, 11:27 AM
Ankit SahuPosted Oct 21, 2017, 2:12 PM
Saddam MohdPosted Oct 21, 2017, 10:39 AM
Amit GuptaPosted Oct 21, 2017, 10:11 AM