private void Button12_Click(object sender, EventArgs e)
{
OleDbCommand aa = new OleDbCommand();
OleDbConnection ab = new OleDbConnection();
ab.ConnectionString = Data.mystr;
ab.Open();
if (TextBox26.Text == "")
{
MessageBox.Show("请输入需要修改的学号");
ab.Close();
}
else
{
string ac = "update xxb set xm='" + TextBox25.Text.Trim() + "',mz='" + ComboBox8.Text.Trim() + "',xb='" + ComboBox7.Text.Trim() + "',dh='" + TextBox24.Text.Trim() + "',ss='" + TextBox23.Text.Trim() + "' ,sfzh='" + TextBox22.Text.Trim() + "' ,nj='" + TextBox21.Text.Trim() + "' ,zzmm='" + ComboBox6.Text.Trim() + "' ,zy='" + ComboBox5.Text.Trim() + "' ,bj='" + TextBox20.Text.Trim() + "' ,jtzz='" + TextBox19.Text.Trim() + "' ,yb='" + TextBox18.Text.Trim() + "' ,jzxm='" + TextBox17.Text.Trim() + "',jzdh='" + TextBox16.Text.Trim() + "' ,bz='" + TextBox15.Text.Trim() + "' where xh=" + TextBox26.Text.Trim();
aa.Connection = ab;
aa.CommandText = ac;
aa.ExecuteNonQuery();
int ni = aa.ExecuteNonQuery();
if (ni > 0)
{
MessageBox.Show("修改成功");
}
else
{
MessageBox.Show("修改失败");
}
}
}
C#使用access数据库对数据表进行update
最新推荐文章于 2025-01-13 10:00:00 发布