this.sqlDataAdapter1.Fill(tempTable);
adAmend = (CurrencyManager)BindingContext[tempTable];
if (this.textBox1.Text.Trim() == "")//检查不能为空的字段
{
MessageBox.Show("用户名不可以为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
adAmend.EndCurrentEdit();//结束当前编辑操作并提交修改
if (tempTable.GetChanges() != null)
{
try
{
this.sqlDataAdapter1.Update(tempTable);
adAmend.Refresh();
MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
catch (Exception express)
{
MessageBox.Show(express.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.tempTable.RejectChanges();
}
}
return;
帮忙看一下这个代码嘛!