private void InsertShopClaimsTarget(ContinueTargetData.RT_SHOPCLAIMSTARGETRow aRow) { StringBuilder sql =new StringBuilder(); sql.Append("insert into RT_ShopClaimsTarget(COMPANYCODE, YEAR, MONTH1QTY,MONTH2QTY,MONTH3QTY,MONTH4QTY,MONTH5QTY,MONTH6QTY,MONTH7QTY, MONTH8QTY,MONTH9QTY,MONTH10QTY,MONTH11QTY,MONTH12QTY, "); sql.Append(" MONTH1AMOUNT,MONTH2AMOUNT,MONTH3AMOUNT,MONTH4AMOUNT,MONTH5AMOUNT,MONTH6AMOUNT,MONTH7AMOUNT,MONTH8AMOUNT,MONTH9AMOUNT,MONTH10AMOUNT,MONTH11AMOUNT,MONTH12AMOUNT, INPUTPERSON, INPUTTIME,LOCALVERSION ) "); sql.Append("values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT TIMESTAMP,1) "); OleDbParameter[] param = new OleDbParameter[27]; param[0] =CreateOleDbParameter("CompanyCode", OleDbType.Char, 2, aRow.COMPANYCODE); param[1] =CreateOleDbParameter("YearMonth", OleDbType.Char, 4, aRow.YEAR); param[2] =CreateOleDbParameter("Month1Qty", OleDbType.Integer,4, aRow["MONTH1QTY"]); param[3] =CreateOleDbParameter("Month2Qty", OleDbType.Integer,4, aRow["MONTH2QTY"]); param[4] =CreateOleDbParameter("Month3Qty", OleDbType.Integer,4, aRow["MONTH3QTY"]); param[5] =CreateOleDbParameter("Month4Qty", OleDbType.Integer,4, aRow["MONTH4QTY"]); param[6] =CreateOleDbParameter("Month5Qty", OleDbType.Integer,4, aRow["MONTH5QTY"]); param[7] =CreateOleDbParameter("Month6Qty", OleDbType.Integer,4, aRow["MONTH6QTY"]); param[8] =CreateOleDbParameter("Month7Qty", OleDbType.Integer,4, aRow["MONTH7QTY"]); param[9] =CreateOleDbParameter("Month18Qty", OleDbType.Integer,4, aRow["MONTH8QTY"]); param[10] =CreateOleDbParameter("Month9Qty", OleDbType.Integer,4, aRow["MONTH9QTY"]); param[11] =CreateOleDbParameter("Month10Qty", OleDbType.Integer,4, aRow["MONTH10QTY"]); param[12] =CreateOleDbParameter("Month11Qty", OleDbType.Integer,4, aRow["MONTH11QTY"]); param[13] =CreateOleDbParameter("Month12Qty", OleDbType.Integer,4, aRow["MONTH12QTY"]); param[14] =CreateOleDbParameter("MONTH1AMOUNT", OleDbType.Decimal,4, aRow["MONTH1AMOUNT"]); param[15] =CreateOleDbParameter("MONTH2AMOUNT", OleDbType.Decimal,4, aRow["MONTH2AMOUNT"]); param[16] =CreateOleDbParameter("MONTH3AMOUNT", OleDbType.Decimal,4, aRow["MONTH3AMOUNT"]); param[17] =CreateOleDbParameter("MONTH4AMOUNT", OleDbType.Decimal,4, aRow["MONTH4AMOUNT"]); param[18] =CreateOleDbParameter("MONTH5AMOUNT", OleDbType.Decimal,4, aRow["MONTH5AMOUNT"]); param[19] =CreateOleDbParameter("MONTH6AMOUNT", OleDbType.Decimal,4, aRow["MONTH6AMOUNT"]); param[20] =CreateOleDbParameter("MONTH7AMOUNT", OleDbType.Decimal,4, aRow["MONTH7AMOUNT"]); param[21] =CreateOleDbParameter("MONTH8AMOUNT", OleDbType.Decimal,4, aRow["MONTH8AMOUNT"]); param[22] =CreateOleDbParameter("MONTH9AMOUNT", OleDbType.Decimal,4, aRow["MONTH9AMOUNT"]); param[23] =CreateOleDbParameter("MONTH10AMOUNT", OleDbType.Decimal,4, aRow["MONTH10AMOUNT"]); param[24] =CreateOleDbParameter("MONTH11AMOUNT", OleDbType.Decimal,4, aRow["MONTH11AMOUNT"]); param[25] =CreateOleDbParameter("MONTH12AMOUNT", OleDbType.Decimal,4, aRow["MONTH12AMOUNT"]); param[26] =CreateOleDbParameter("INPUTPERSON", OleDbType.Integer,4,DmsContext.CurrentUserID); this.ExecuteNonQuery(sql.ToString(), param); }
修改后的代码
private void InsertShopClaimsTarget(ContinueTargetData.RT_SHOPCLAIMSTARGETRow aRow) { StringBuilder sql =new StringBuilder(); sql.Append("insert into RT_ShopClaimsTarget(COMPANYCODE, YEAR, MONTH1QTY,MONTH2QTY,MONTH3QTY,MONTH4QTY,MONTH5QTY,MONTH6QTY,MONTH7QTY, MONTH8QTY,MONTH9QTY,MONTH10QTY,MONTH11QTY,MONTH12QTY, "); sql.Append(" MONTH1AMOUNT,MONTH2AMOUNT,MONTH3AMOUNT,MONTH4AMOUNT,MONTH5AMOUNT,MONTH6AMOUNT,MONTH7AMOUNT,MONTH8AMOUNT,MONTH9AMOUNT,MONTH10AMOUNT,MONTH11AMOUNT,MONTH12AMOUNT, INPUTPERSON, INPUTTIME,LOCALVERSION ) "); sql.Append("values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT TIMESTAMP,1) "); OleDbParameter[] param = new OleDbParameter[27]; param[0] =CreateOleDbParameter("CompanyCode", OleDbType.Char, 2, aRow.COMPANYCODE); param[1] =CreateOleDbParameter("YearMonth", OleDbType.Char, 4, aRow.YEAR); param[2] =CreateOleDbParameter("Month1Qty", OleDbType.Integer,4, aRow["MONTH1QTY"]); param[3] =CreateOleDbParameter("Month2Qty", OleDbType.Integer,4, aRow["MONTH2QTY"]); param[4] =CreateOleDbParameter("Month3Qty", OleDbType.Integer,4, aRow["MONTH3QTY"]); param[5] =CreateOleDbParameter("Month4Qty", OleDbType.Integer,4, aRow["MONTH4QTY"]); param[6] =CreateOleDbParameter("Month5Qty", OleDbType.Integer,4, aRow["MONTH5QTY"]); param[7] =CreateOleDbParameter("Month6Qty", OleDbType.Integer,4, aRow["MONTH6QTY"]); param[8] =CreateOleDbParameter("Month7Qty", OleDbType.Integer,4, aRow["MONTH7QTY"]); param[9] =CreateOleDbParameter("Month18Qty", OleDbType.Integer,4, aRow["MONTH8QTY"]); param[10] =CreateOleDbParameter("Month9Qty", OleDbType.Integer,4, aRow["MONTH9QTY"]); param[11] =CreateOleDbParameter("Month10Qty", OleDbType.Integer,4, aRow["MONTH10QTY"]); param[12] =CreateOleDbParameter("Month11Qty", OleDbType.Integer,4, aRow["MONTH11QTY"]); param[13] =CreateOleDbParameter("Month12Qty", OleDbType.Integer,4, aRow["MONTH12QTY"]); param[14] =CreateOleDbParameter("MONTH1AMOUNT", OleDbType.Double,4, aRow["MONTH1AMOUNT"]); param[15] =CreateOleDbParameter("MONTH2AMOUNT", OleDbType.Double,4, aRow["MONTH2AMOUNT"]); param[16] =CreateOleDbParameter("MONTH3AMOUNT", OleDbType.Double,4, aRow["MONTH3AMOUNT"]); param[17] =CreateOleDbParameter("MONTH4AMOUNT", OleDbType.Double,4, aRow["MONTH4AMOUNT"]); param[18] =CreateOleDbParameter("MONTH5AMOUNT", OleDbType.Double,4, aRow["MONTH5AMOUNT"]); param[19] =CreateOleDbParameter("MONTH6AMOUNT", OleDbType.Double,4, aRow["MONTH6AMOUNT"]); param[20] =CreateOleDbParameter("MONTH7AMOUNT", OleDbType.Double,4, aRow["MONTH7AMOUNT"]); param[21] =CreateOleDbParameter("MONTH8AMOUNT", OleDbType.Double,4, aRow["MONTH8AMOUNT"]); param[22] =CreateOleDbParameter("MONTH9AMOUNT", OleDbType.Double,4, aRow["MONTH9AMOUNT"]); param[23] =CreateOleDbParameter("MONTH10AMOUNT", OleDbType.Double,4, aRow["MONTH10AMOUNT"]); param[24] =CreateOleDbParameter("MONTH11AMOUNT", OleDbType.Double,4, aRow["MONTH11AMOUNT"]); param[25] =CreateOleDbParameter("MONTH12AMOUNT", OleDbType.Double,4, aRow["MONTH12AMOUNT"]); param[26] =CreateOleDbParameter("INPUTPERSON", OleDbType.Integer,4,DmsContext.CurrentUserID); this.ExecuteNonQuery(sql.ToString(), param); }