The following exception is thrown when I run the below code:
system.data.oledb.oledbexception data type mismatch in criteria expression
private void buttonUp_Click(object sender, EventArgs e)
{
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "UPDATE data SET Name ='"+txtNL.Text+"' , Period ='"+txtper.Text+"' , DOB = '"+txtmonth.Text+"', price = '"+txtprice.Text+"', follow = '"+combofw.Text+"' WHERE ID = "+txtid.Text+" ";
//(ID,Name,Period,DOB,price,follow)
MessageBox.Show(query);
command.CommandText = query;
command.ExecuteNonQuery();
MessageBox.Show("Data Edited/Updated Successful");
connection.Close();
}
catch (Exception ex)
{ MessageBox.Show("Error " + ex); }
}
How can I fix this?