由网友(少年玩命不玩心 //)分享简介:您好,我有一个DataRow掏出一个DataTable从一个数据集。我访问了在SQL定义为float数据类型的列。我想这个值赋给一个局部变量(C#浮点数据类型),但我得到一个InvalidCastExecption Howdy, I have a DataRow pulled out of a DataTable...
您好,我有一个DataRow掏出一个DataTable从一个数据集。我访问了在SQL定义为float数据类型的列。我想这个值赋给一个局部变量(C#浮点数据类型),但我得到一个InvalidCastExecption
Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption
DataRow exercise = _exerciseDataSet.Exercise.FindByExerciseID(65);
_AccelLimit = (float)exercise["DefaultAccelLimit"];
现在,这个我也使它工作玩了,但它并没有任何意义,并没有觉得不对劲。
Now, playing around with this I did make it work but it did not make any sense and it didn't feel right.
_AccelLimit = (float)(double)exercise["DefaultAccelLimit"];
谁能解释我在这里失踪了什么?
Can anyone explain what I am missing here?
推荐答案
一个SQL浮动是双重根据的为的SqlDbType 的文档。
A SQL float is a double according to the documentation for SQLDbType.
相关推荐
最新文章