Sql server real datatype, c#等价是什么?

时间:2022-09-16 14:22:21

What is the C# equivalent to the sql server 2005 real type?

c#与sql server 2005真实类型的等效是什么?

5 个解决方案

#1


67  

it is a Single

它是一个单一

see here for more info on SQL Server to .Net DataTypes

有关SQL Server到。net数据类型的更多信息,请参见这里。

#2


9  

Single is not the correct answer as it rounds the decimal part.. For instance 2.0799999 will be converted to 2.08. If there are no constraints regarding the rounding then it should be good.

1 .小数部分四舍五入,所以单数是不正确的。例如,2.0799999将被转换为2.08。如果四舍五入没有限制,那就应该是好的。

#3


7  

Double can be used as the .NET Equivalent Datatype for Real Datatype of SQL Server

对于SQL Server的实际数据类型,Double可以作为。net等价数据类型。

Double gets the exact value with out Rounding

双取整圆的精确值。

#4


4  

The answer is float. If you try to use double as the type in the code but your field type in the database is real it will errors out. I just tested this myself and confirmed it errors with double.

答案是浮动的。如果您试图在代码中使用double作为类型,但是您在数据库中的字段类型是真实的,那么将会出错。我自己测试了一下,用double来确认它的错误。

#5


1  

in my project (acces -> firebird and ms sql -> c#) is real defined like single precission float point number...so I used float and everything is OK

在我的项目中(acces -> firebird和ms sql -> c#)是真正定义为单个精确浮点数…我用了float,一切都没问题

#1


67  

it is a Single

它是一个单一

see here for more info on SQL Server to .Net DataTypes

有关SQL Server到。net数据类型的更多信息,请参见这里。

#2


9  

Single is not the correct answer as it rounds the decimal part.. For instance 2.0799999 will be converted to 2.08. If there are no constraints regarding the rounding then it should be good.

1 .小数部分四舍五入,所以单数是不正确的。例如,2.0799999将被转换为2.08。如果四舍五入没有限制,那就应该是好的。

#3


7  

Double can be used as the .NET Equivalent Datatype for Real Datatype of SQL Server

对于SQL Server的实际数据类型,Double可以作为。net等价数据类型。

Double gets the exact value with out Rounding

双取整圆的精确值。

#4


4  

The answer is float. If you try to use double as the type in the code but your field type in the database is real it will errors out. I just tested this myself and confirmed it errors with double.

答案是浮动的。如果您试图在代码中使用double作为类型,但是您在数据库中的字段类型是真实的,那么将会出错。我自己测试了一下,用double来确认它的错误。

#5


1  

in my project (acces -> firebird and ms sql -> c#) is real defined like single precission float point number...so I used float and everything is OK

在我的项目中(acces -> firebird和ms sql -> c#)是真正定义为单个精确浮点数…我用了float,一切都没问题