<log>
<id>d74ad268-25f5-4fb8-b91a-b02ce42e1dc2</id>
<time>2010-12-15 15:38:58</time>
<message>System.Data.SqlClient.SqlException: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 16 ("@decTaxamtOriginal"): The supplied value is not a valid instance of data type numeric. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision.
at Forms.BQSFORMT034.DAL.VMI_PTRANS_D.AddItem(VMI_PTRANS_D p_objSub)
at Forms.BQSFORMT034.Facade.VMI_PTRANS_D.AddItem(VMI_PTRANS_D p_objSub)
at Forms.BQSFORMT034.BQSFORMT034A.btnVPNOSearch_Click(Object sender, EventArgs e)</message>
<category>Forms</category>
<module>BQSFORMT034</module>
<level>Info</level>
</log>
提示数据长度超过该栏位类型所允许的范围.
数据库中数据类型为decimal(18,2)
通过写日志记录数据位1.235435454745465
有点是不是容易被人忽略了呢.
BQSFORMT034.DAL.VMI_PTRANS_D.AddItem(VMI_PTRANS_D p_objSub)
sqlParas[13] = new SqlParameter();
sqlParas[13].ParameterName = "@decTaxamt";
sqlParas[13].SqlDbType = SqlDbType.Decimal;
sqlParas[13].Precision = 18;
sqlParas[13].Scale=2;
sqlParas[13].Direction = ParameterDirection.Input;
sqlParas[13].Value = p_objSub.Taxamt;
就是这个参数的地方 对Decimal加上Precision,和Scale设定后,便可解决问题