SqlBulkCopy Precision Error from C# Double to Sql Decimal?

https://forums.asp.net/t/1300113.aspx?SqlBulkCopy+Precision+Error+from+C+Double+to+Sql+Decimal+

Before I bulkcopy data into the database, I use DataTable to store the bulk of data.

Since the value to be stored is declared as double in the DataTable, I defined the datatype of that data column to be double too.

This causes a conversion problem as somewhere along the chain (I am suspecting the SqlBulkCopy is doing some kind of implicit conversion) the precision of my value was changed.

Ever since I changed the data type of that data column from double into decimal and explicitly convert the datatype before storing into the DataTable, the problem is fixed. 

C# double to sql server lost precision

猜你喜欢

转载自www.cnblogs.com/chucklu/p/10518791.html
今日推荐