OleDbType.Decimal在插入DB2后会默认赋值0.00,改为OleDbType.Double则正常

     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[];
param[] =CreateOleDbParameter("CompanyCode", OleDbType.Char, , aRow.COMPANYCODE);
param[] =CreateOleDbParameter("YearMonth", OleDbType.Char, , aRow.YEAR);
param[] =CreateOleDbParameter("Month1Qty", OleDbType.Integer,, aRow["MONTH1QTY"]);
param[] =CreateOleDbParameter("Month2Qty", OleDbType.Integer,, aRow["MONTH2QTY"]);
param[] =CreateOleDbParameter("Month3Qty", OleDbType.Integer,, aRow["MONTH3QTY"]);
param[] =CreateOleDbParameter("Month4Qty", OleDbType.Integer,, aRow["MONTH4QTY"]);
param[] =CreateOleDbParameter("Month5Qty", OleDbType.Integer,, aRow["MONTH5QTY"]);
param[] =CreateOleDbParameter("Month6Qty", OleDbType.Integer,, aRow["MONTH6QTY"]);
param[] =CreateOleDbParameter("Month7Qty", OleDbType.Integer,, aRow["MONTH7QTY"]);
param[] =CreateOleDbParameter("Month18Qty", OleDbType.Integer,, aRow["MONTH8QTY"]);
param[] =CreateOleDbParameter("Month9Qty", OleDbType.Integer,, aRow["MONTH9QTY"]);
param[] =CreateOleDbParameter("Month10Qty", OleDbType.Integer,, aRow["MONTH10QTY"]);
param[] =CreateOleDbParameter("Month11Qty", OleDbType.Integer,, aRow["MONTH11QTY"]);
param[] =CreateOleDbParameter("Month12Qty", OleDbType.Integer,, aRow["MONTH12QTY"]);
param[] =CreateOleDbParameter("MONTH1AMOUNT", OleDbType.Decimal,, aRow["MONTH1AMOUNT"]);
param[] =CreateOleDbParameter("MONTH2AMOUNT", OleDbType.Decimal,, aRow["MONTH2AMOUNT"]);
param[] =CreateOleDbParameter("MONTH3AMOUNT", OleDbType.Decimal,, aRow["MONTH3AMOUNT"]);
param[] =CreateOleDbParameter("MONTH4AMOUNT", OleDbType.Decimal,, aRow["MONTH4AMOUNT"]);
param[] =CreateOleDbParameter("MONTH5AMOUNT", OleDbType.Decimal,, aRow["MONTH5AMOUNT"]);
param[] =CreateOleDbParameter("MONTH6AMOUNT", OleDbType.Decimal,, aRow["MONTH6AMOUNT"]);
param[] =CreateOleDbParameter("MONTH7AMOUNT", OleDbType.Decimal,, aRow["MONTH7AMOUNT"]);
param[] =CreateOleDbParameter("MONTH8AMOUNT", OleDbType.Decimal,, aRow["MONTH8AMOUNT"]);
param[] =CreateOleDbParameter("MONTH9AMOUNT", OleDbType.Decimal,, aRow["MONTH9AMOUNT"]);
param[] =CreateOleDbParameter("MONTH10AMOUNT", OleDbType.Decimal,, aRow["MONTH10AMOUNT"]);
param[] =CreateOleDbParameter("MONTH11AMOUNT", OleDbType.Decimal,, aRow["MONTH11AMOUNT"]);
param[] =CreateOleDbParameter("MONTH12AMOUNT", OleDbType.Decimal,, aRow["MONTH12AMOUNT"]);
param[] =CreateOleDbParameter("INPUTPERSON", OleDbType.Integer,,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[];
param[] =CreateOleDbParameter("CompanyCode", OleDbType.Char, , aRow.COMPANYCODE);
param[] =CreateOleDbParameter("YearMonth", OleDbType.Char, , aRow.YEAR);
param[] =CreateOleDbParameter("Month1Qty", OleDbType.Integer,, aRow["MONTH1QTY"]);
param[] =CreateOleDbParameter("Month2Qty", OleDbType.Integer,, aRow["MONTH2QTY"]);
param[] =CreateOleDbParameter("Month3Qty", OleDbType.Integer,, aRow["MONTH3QTY"]);
param[] =CreateOleDbParameter("Month4Qty", OleDbType.Integer,, aRow["MONTH4QTY"]);
param[] =CreateOleDbParameter("Month5Qty", OleDbType.Integer,, aRow["MONTH5QTY"]);
param[] =CreateOleDbParameter("Month6Qty", OleDbType.Integer,, aRow["MONTH6QTY"]);
param[] =CreateOleDbParameter("Month7Qty", OleDbType.Integer,, aRow["MONTH7QTY"]);
param[] =CreateOleDbParameter("Month18Qty", OleDbType.Integer,, aRow["MONTH8QTY"]);
param[] =CreateOleDbParameter("Month9Qty", OleDbType.Integer,, aRow["MONTH9QTY"]);
param[] =CreateOleDbParameter("Month10Qty", OleDbType.Integer,, aRow["MONTH10QTY"]);
param[] =CreateOleDbParameter("Month11Qty", OleDbType.Integer,, aRow["MONTH11QTY"]);
param[] =CreateOleDbParameter("Month12Qty", OleDbType.Integer,, aRow["MONTH12QTY"]);
param[] =CreateOleDbParameter("MONTH1AMOUNT", OleDbType.Double,, aRow["MONTH1AMOUNT"]);
param[] =CreateOleDbParameter("MONTH2AMOUNT", OleDbType.Double,, aRow["MONTH2AMOUNT"]);
param[] =CreateOleDbParameter("MONTH3AMOUNT", OleDbType.Double,, aRow["MONTH3AMOUNT"]);
param[] =CreateOleDbParameter("MONTH4AMOUNT", OleDbType.Double,, aRow["MONTH4AMOUNT"]);
param[] =CreateOleDbParameter("MONTH5AMOUNT", OleDbType.Double,, aRow["MONTH5AMOUNT"]);
param[] =CreateOleDbParameter("MONTH6AMOUNT", OleDbType.Double,, aRow["MONTH6AMOUNT"]);
param[] =CreateOleDbParameter("MONTH7AMOUNT", OleDbType.Double,, aRow["MONTH7AMOUNT"]);
param[] =CreateOleDbParameter("MONTH8AMOUNT", OleDbType.Double,, aRow["MONTH8AMOUNT"]);
param[] =CreateOleDbParameter("MONTH9AMOUNT", OleDbType.Double,, aRow["MONTH9AMOUNT"]);
param[] =CreateOleDbParameter("MONTH10AMOUNT", OleDbType.Double,, aRow["MONTH10AMOUNT"]);
param[] =CreateOleDbParameter("MONTH11AMOUNT", OleDbType.Double,, aRow["MONTH11AMOUNT"]);
param[] =CreateOleDbParameter("MONTH12AMOUNT", OleDbType.Double,, aRow["MONTH12AMOUNT"]);
param[] =CreateOleDbParameter("INPUTPERSON", OleDbType.Integer,,DmsContext.CurrentUserID);
this.ExecuteNonQuery(sql.ToString(), param);
}
上一篇:sh_脚本语法


下一篇:【bzoj4817】树点涂色 LCT+线段树+dfs序