var name= Request.PostString("name"); data.Odr = Request.PostInt("odr"); var typeid = Request.PostInt("typeid"); data.MID = manager.ID; data.CreateTime = DateTime.Now; data.DisIds = Request.PostString("disid"); if (Exec.IsNullOrEmpty(name)) { ExtDialog.Dialog(this, "请输入名称", 4); return; } if (data.ID > 0) { if (name!=data.Name&&typeid!=data.TypeId) { if (PublicQuery.IsExtGrade(name, typeid)) { ExtDialog.Dialog(this, "该年级已经存在,请检查!", 4); return; } } data.Name = name;data.TypeId = typeid; if (data.Update() <= 0) { ExtDialog.Dialog(this, "数据更新出错,联系管理员", 4, _url: "grade_list.aspx"); return; } else { ExtDialog.Dialog(this, "编辑成功", 5, _url: "grade_list.aspx"); return; } } else { if (PublicQuery.IsExtGrade(name, typeid)) { ExtDialog.Dialog(this, "该年级已经存在,请检查!", 4); return; } data.Name = name;data.TypeId = typeid; if (data.Insert() <= 0) { ExtDialog.Dialog(this, "数据插入出错,联系管理员", 4, _url: "grade_list.aspx"); return; } else { ExtDialog.Dialog(this, "插入成功", 5, _url: "grade_list.aspx"); return; } }
现在有最新的办法:
在写Sql时,将此次ID写入条件中。如当前id=3, 则条件为where id!=3