private void btnDelete_Click(object sender, EventArgs e)
{
if (cmbID.Text == "")
{
MessageBox.Show("请选择数据号", "系统错误");
return;
}
try
{
string connectstring = "provider=Microsoft.jet.OLEDB.4.0;Data Source=accountsystem.mdb;Jet OleDb:Database Password=lxw618";
string sqlcommand = "delete from [Money] where ID=" + cmbID.Text;
OleDbConnection aConnection = new OleDbConnection(connectstring);
aConnection.Open();
OleDbCommand aCommand = new OleDbCommand(sqlcommand, aConnection);
aCommand.ExecuteNonQuery();
aConnection.Close();
this.btnFresh_Click(sender, e);
MessageBox.Show("删除成功", "恭喜");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "系统错误");
this.DeleteRecord_Load(sender, e);
return;
}
}
}