本文介绍了负数值的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一张表,需要在其中一列中存储-562,000.00之类的值.我已经声明该列的字段类型为numeric(18,2).我正在尝试使用存储过程来更新这些列,但是当我从代码中将参数添加到命令对象中时,为
HI All,
i have a table which needs to store values like -562,000.00 in one of its columns. i have declared the field type to be numeric(18,2) for that column. I am trying to update that columns using a Stored Procedure but wheni add parameters to the command object from code as
comm1.Parameters.Add("@Excl", SqlDbType.Decimal).Value = Convert.ToDecimal(objDataSet.Tables[0].Rows[i]["Excl"]);
我遇到错误.
我应该在这里使用什么数据类型?
谢谢.
I am getting an error.
What is the Datatype i should be using here?
Thanks.
推荐答案
comm1.Parameters.Add("@Excl", SqlDbType.Decimal).Value = Convert.Single(objDataSet.Tables[0].Rows[i]["Excl"]);
或
or
comm1.Parameters.Add("@Excl", SqlDbType.Float).Value = Convert.Single(objDataSet.Tables[0].Rows[i]["Excl"]);
这篇关于负数值的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!