/// <summary> /// 修改一个集合 SQL /// </summary> public string UpdateRangeSQL(INSPECTION_DEV_REG_INFO model, string p_strWhere) { string strUpdateSQL = ""; if (model.Changed("JCXH") == true && model.JCXH != null) { strUpdateSQL += ",JCXH=" + model.JCXH + ""; } if (model.Changed("SBLX") == true && model.SBLX != null) { strUpdateSQL += ",SBLX='" + model.SBLX.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBMC") == true && model.SBMC != null) { strUpdateSQL += ",SBMC='" + model.SBMC.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBMCDH") == true && model.SBMCDH != null) { strUpdateSQL += ",SBMCDH='" + model.SBMCDH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBZZC") == true && model.SBZZC != null) { strUpdateSQL += ",SBZZC='" + model.SBZZC.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBXH") == true && model.SBXH != null) { strUpdateSQL += ",SBXH='" + model.SBXH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBCCBH") == true && model.SBCCBH != null) { strUpdateSQL += ",SBCCBH='" + model.SBCCBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBCCRQ") == true && model.SBCCRQ != null) { strUpdateSQL += ",SBCCRQ='" + model.SBCCRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZBH") == true && model.SBRZBH != null) { strUpdateSQL += ",SBRZBH='" + model.SBRZBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZRQ") == true && model.SBRZRQ != null) { strUpdateSQL += ",SBRZRQ='" + model.SBRZRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZYXQZ") == true && model.SBRZYXQZ != null) { strUpdateSQL += ",SBRZYXQZ='" + model.SBRZYXQZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDBH") == true && model.JLBDBH != null) { strUpdateSQL += ",JLBDBH='" + model.JLBDBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDRQ") == true && model.JLBDRQ != null) { strUpdateSQL += ",JLBDRQ='" + model.JLBDRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDYXQZ") == true && model.JLBDYXQZ != null) { strUpdateSQL += ",JLBDYXQZ='" + model.JLBDYXQZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("BZ") == true && model.BZ != null) { strUpdateSQL += ",BZ='" + model.BZ.ToString().Replace("'", "''") + "'"; } string strSql = ""; strSql += "update INSPECTION_DEV_REG_INFO set "; strSql += strUpdateSQL.Substring(1); strSql += " where " + p_strWhere; return(strSql); }
/// <summary> /// 添加一条数据 SQL /// </summary> public string InsertSQL(INSPECTION_DEV_REG_INFO model) { string strFieldSQL = ""; string strValueSQL = ""; if (model.Changed("JCXH") == true && model.JCXH != null) { strFieldSQL += ",JCXH"; strValueSQL += "," + model.JCXH + ""; } if (model.Changed("SBLX") == true && model.SBLX != null) { strFieldSQL += ",SBLX"; strValueSQL += ",'" + model.SBLX.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBMC") == true && model.SBMC != null) { strFieldSQL += ",SBMC"; strValueSQL += ",'" + model.SBMC.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBMCDH") == true && model.SBMCDH != null) { strFieldSQL += ",SBMCDH"; strValueSQL += ",'" + model.SBMCDH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBZZC") == true && model.SBZZC != null) { strFieldSQL += ",SBZZC"; strValueSQL += ",'" + model.SBZZC.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBXH") == true && model.SBXH != null) { strFieldSQL += ",SBXH"; strValueSQL += ",'" + model.SBXH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBCCBH") == true && model.SBCCBH != null) { strFieldSQL += ",SBCCBH"; strValueSQL += ",'" + model.SBCCBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBCCRQ") == true && model.SBCCRQ != null) { strFieldSQL += ",SBCCRQ"; strValueSQL += ",'" + model.SBCCRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZBH") == true && model.SBRZBH != null) { strFieldSQL += ",SBRZBH"; strValueSQL += ",'" + model.SBRZBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZRQ") == true && model.SBRZRQ != null) { strFieldSQL += ",SBRZRQ"; strValueSQL += ",'" + model.SBRZRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("SBRZYXQZ") == true && model.SBRZYXQZ != null) { strFieldSQL += ",SBRZYXQZ"; strValueSQL += ",'" + model.SBRZYXQZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDBH") == true && model.JLBDBH != null) { strFieldSQL += ",JLBDBH"; strValueSQL += ",'" + model.JLBDBH.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDRQ") == true && model.JLBDRQ != null) { strFieldSQL += ",JLBDRQ"; strValueSQL += ",'" + model.JLBDRQ.ToString().Replace("'", "''") + "'"; } if (model.Changed("JLBDYXQZ") == true && model.JLBDYXQZ != null) { strFieldSQL += ",JLBDYXQZ"; strValueSQL += ",'" + model.JLBDYXQZ.ToString().Replace("'", "''") + "'"; } if (model.Changed("BZ") == true && model.BZ != null) { strFieldSQL += ",BZ"; strValueSQL += ",'" + model.BZ.ToString().Replace("'", "''") + "'"; } string strSql = ""; strSql += "insert into INSPECTION_DEV_REG_INFO"; strSql += "("; strSql += strFieldSQL.Substring(1); strSql += ")"; strSql += " values"; strSql += "("; strSql += strValueSQL.Substring(1); strSql += ")"; return(strSql); }