/// <summary> /// 修改一个集合 SQL /// </summary> public string UpdateRangeSQL(DEV_STANDARD_LD model, string p_strWhere) { string strUpdateSQL = ""; if (model.Changed("SEARCH_CONDITION") == true && model.SEARCH_CONDITION != null) { strUpdateSQL += ",SEARCH_CONDITION='" + model.SEARCH_CONDITION.ToString().Replace("'", "''") + "'"; } if (model.Changed("ZXMC") == true && model.ZXMC != null) { strUpdateSQL += ",ZXMC='" + model.ZXMC.ToString().Replace("'", "''") + "'"; } if (model.Changed("GXSXSXZ") == true && model.GXSXSXZ != null) { strUpdateSQL += ",GXSXSXZ='" + model.GXSXSXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("GLXZ") == true && model.GLXZ != null) { strUpdateSQL += ",GLXZ='" + model.GLXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("ZSXZ") == true && model.ZSXZ != null) { strUpdateSQL += ",ZSXZ='" + model.ZSXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("IS_SHOW") == true && model.IS_SHOW != null) { strUpdateSQL += ",IS_SHOW=" + model.IS_SHOW + ""; } if (model.Changed("AREA_NAME") == true && model.AREA_NAME != null) { strUpdateSQL += ",AREA_NAME='" + model.AREA_NAME.ToString().Replace("'", "''") + "'"; } if (model.Changed("UTYPE") == true && model.UTYPE != null) { strUpdateSQL += ",UTYPE=" + model.UTYPE + ""; } if (model.Changed("NOXZ") == true && model.NOXZ != null) { strUpdateSQL += ",NOXZ='" + model.NOXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("LGMXZ") == true && model.LGMXZ != null) { strUpdateSQL += ",LGMXZ='" + model.LGMXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("HSUXZ") == true && model.HSUXZ != null) { strUpdateSQL += ",HSUXZ='" + model.HSUXZ.ToString().Replace("'", "''") + "'"; } string strSql = ""; strSql += "update DEV_STANDARD_LD set "; strSql += strUpdateSQL.Substring(1); strSql += " where " + p_strWhere; return(strSql); }
/// <summary> /// 添加一条数据 SQL /// </summary> public string InsertSQL(DEV_STANDARD_LD model) { string strFieldSQL = ""; string strValueSQL = ""; if (model.Changed("SEARCH_CONDITION") == true && model.SEARCH_CONDITION != null) { strFieldSQL += ",SEARCH_CONDITION"; strValueSQL += ",'" + model.SEARCH_CONDITION.ToString().Replace("'", "''") + "'"; } if (model.Changed("ZXMC") == true && model.ZXMC != null) { strFieldSQL += ",ZXMC"; strValueSQL += ",'" + model.ZXMC.ToString().Replace("'", "''") + "'"; } if (model.Changed("GXSXSXZ") == true && model.GXSXSXZ != null) { strFieldSQL += ",GXSXSXZ"; strValueSQL += ",'" + model.GXSXSXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("GLXZ") == true && model.GLXZ != null) { strFieldSQL += ",GLXZ"; strValueSQL += ",'" + model.GLXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("ZSXZ") == true && model.ZSXZ != null) { strFieldSQL += ",ZSXZ"; strValueSQL += ",'" + model.ZSXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("IS_SHOW") == true && model.IS_SHOW != null) { strFieldSQL += ",IS_SHOW"; strValueSQL += "," + model.IS_SHOW + ""; } if (model.Changed("AREA_NAME") == true && model.AREA_NAME != null) { strFieldSQL += ",AREA_NAME"; strValueSQL += ",'" + model.AREA_NAME.ToString().Replace("'", "''") + "'"; } if (model.Changed("UTYPE") == true && model.UTYPE != null) { strFieldSQL += ",UTYPE"; strValueSQL += "," + model.UTYPE + ""; } if (model.Changed("NOXZ") == true && model.NOXZ != null) { strFieldSQL += ",NOXZ"; strValueSQL += ",'" + model.NOXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("LGMXZ") == true && model.LGMXZ != null) { strFieldSQL += ",LGMXZ"; strValueSQL += ",'" + model.LGMXZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("HSUXZ") == true && model.HSUXZ != null) { strFieldSQL += ",HSUXZ"; strValueSQL += ",'" + model.HSUXZ.ToString().Replace("'", "''") + "'"; } string strSql = ""; strSql += "insert into DEV_STANDARD_LD"; strSql += "("; strSql += strFieldSQL.Substring(1); strSql += ")"; strSql += " values"; strSql += "("; strSql += strValueSQL.Substring(1); strSql += ")"; return(strSql); }