"Ошибка синтаксиса в инструкции UPDATE.", хотя вроде всё написано правильно.
private void button1_Click(object sender, EventArgs e)
{
string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=BD1.mdb";
con = new OleDbConnection(connectString);
con.Open();
string query = "";
if (frm.radVal == 0)
{
query = string.Format("UPDATE Developers SET Developer_name = '" + textBox1.Text +"', Developer_specialty = '"+ textBox3.Text +"', team_id = "+ textBox2.Text +", Password = '"+ textBox4.Text +"' WHERE Developer_id = "+ id +";");
}
else if (frm.radVal == 1)
{
query = "UPDATE Managers SET Manager_name = '" + textBox1.Text + "', Admin_id = '" + textBox3.Text + "', Password = '" + textBox2.Text + "' WHERE Manager_id = '" + id + "'";
}
else if (frm.radVal == 2)
{
query = "UPDATE Admins SET Admin_name = '" + textBox1.Text + "', Password = '" + textBox2.Text + "' WHERE Admin_id = '" + id + "'";
}
cmd = new OleDbCommand(query, con);
MessageBox.Show(query);
int number = cmd.ExecuteNonQuery();
Console.WriteLine("Обновлено объектов: {0}", number);
//MessageBox.Show(cmd.ExecuteScalar().ToString());
if (button1.Focused)
{
MessageBox.Show("Данные успешно обновлены");
}
}