Sql server real datatype, what is the C# equivalent?

前端 未结 7 2040
难免孤独
难免孤独 2020-12-29 18:19

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

相关标签:
7条回答
  • 2020-12-29 18:31

    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.

    0 讨论(0)
  • 2020-12-29 18:34

    Its Equivalent is Single. Single is A floating point number within the range of -3.40E +38 through 3.40E +38.

    Here is the latest from MSDN describes all SqlDbType and C# Equivalents

    0 讨论(0)
  • 2020-12-29 18:35

    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.

    0 讨论(0)
  • 2020-12-29 18:37

    it is a Single

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

    0 讨论(0)
  • 2020-12-29 18:37

    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

    0 讨论(0)
  • 2020-12-29 18:37

    the answer is Single or float. (depending on style.) this is like the difference between String and string [source: ReSharper code suggestion "use type keyword" when using Single. it suggested using float.

    0 讨论(0)
提交回复
热议问题