protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { id = Req.GetID(); if (id < 1) { msgG.Error("非法操作3"); } LL(); } }
/// <summary> /// 删除多条(包括删除文件) 复选框名为IsSel /// </summary> /// <param name="pTableName">表名</param> /// <param name="pPKName">主键字段名(根据此字段删除记录)</param> /// <param name="pDeleteFields">文件字段名 一条记录需要删除多个文件 用字段名并逗号隔开 如 PicS,PicB</param> /// <param name="pPathFormat">文件相对路径 如 /upload_file/pic/ 必需以/开始 以/结束</param> public static int DeleteMore(string pTableName, string pPKName, string pDeleteFields, string pPathFormat) { IMessage MessageG = new MessageGeneral(); string[] aSel = pDeleteFields.Split(','); int aSelN = aSel.Length; string sArrStr = Req.GetForm("IsSel"); if (!Fn.IsIntArrBool(sArrStr)) { MessageG.Error("请选择要删除的记录."); } string sSQL = "select " + pDeleteFields + " from " + pTableName + " where " + pPKName + " in(" + sArrStr + ")"; DataTable dt = DbHelp.GetDataTable(sSQL); foreach (DataRow drw in dt.Rows) { foreach (string s in aSel) { WZ.Common.OperationFile.FileCommon.Delete(string.Format(pPathFormat, drw[s])); } } sSQL = "delete from " + pTableName + " where " + pPKName + " in(" + sArrStr + ")"; return(DbHelp.Update(sSQL)); //HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.ToString()); }
public static int DeleteMore(string pTableName, string pPKName, string pHtmlID) { IMessage MessageG = new MessageGeneral(); string sArrStr = Req.GetForm(pHtmlID); if (!Fn.IsIntArrBool(sArrStr)) { MessageG.Error("请选择要删除的记录."); } string sSQL = "delete from " + pTableName + " where " + pPKName + " in(" + sArrStr + ")"; return(DbHelp.Update(sSQL)); //HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.ToString()); }