int iMaxID = SqlServerHelper.GetMaxID(out sError, "id", "test");
string sSql = "update test set name='name_jonse',remark='remark_jonse' where id=" + iMaxID;
sError = string.Empty;
bool bResult = SqlServerHelper.UpdateData(out sError, sSql, true);
if (bResult)
Common.DisplayMsg(this.Text, "修改成功");
else
Common.DisplayMsg(this.Text, sError);
InitGrid();
// 删除
sError = string.Empty;
int iMaxID = SqlServerHelper.GetMaxID(out sError, "id", "test");
string sSql = "delete from test where id=" + iMaxID;
sError = string.Empty;
bool bResult = SqlServerHelper.UpdateData(out sError, sSql);
if (bResult)
Common.DisplayMsg(this.Text, "删除成功");
else
Common.DisplayMsg(this.Text, sError);
InitGrid();
五,其它
public static void DisplayMsg(string sCaption, string sMsg)
{
sMsg = sMsg.TrimEnd('!').TrimEnd('!') + " !";
MessageBox.Show(sMsg, sCaption);
}

摘自:keenweiwei的专栏