When I run the below query, I get syntax error in query expression.
private void button8_Click(object sender, EventArgs e)
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query1 = "UPDATE Points SET PNTS =
(case when EmpName = '" + comboBox1.Text +
"' then '" + label15.Text + "' when EmpName = '" +
comboBox2.Text + "' then '" + label16.Text +
"' when EmpName = '" + comboBox3.Text + "' then '" +
label17.Text + "' end) WHERE EmpName in ('" +
comboBox1.Text + "', '" + comboBox2.Text + "', '" +
comboBox3.Text + "')";
command.CommandText = query1;
command.ExecuteNonQuery();
connection.Close();
}
The error is:
Syntax error (missing operator) in query expression '(case when EmpName = 'Sam' then '5.6' when EmpName = 'shane' then '1.6' when EmpName = 'Mike' then '0.8' end)'.