if (conn.State == ConnectionState.Closed) conn.Open();
OleDbCommand mydc;
try
{
string str = "UPDATE student SET 姓名='" + textBox2.Text.Trim() + "',班级='" + textBox3.Text.Trim() + "',系别='" + textBox4.Text.Trim() + "',表现='" + textBox5.Text.Trim() + "',备注='" + textBox6.Text.Trim() + "' where 学号= '" + textBox1.Text.Trim() + "'";
mydc = new OleDbCommand(str, conn);
if (mydc.ExecuteNonQuery() > 0)
{
MessageBox.Show("修改成功!");
this.Dispose();
}
else
{
MessageBox.Show("修改不成功,请稍后在试!");
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox6.Clear();
}
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}
finally
{
conn.Close();
}