Float in Database to ? in .NET

前端 未结 6 2259
花落未央
花落未央 2020-12-30 20:06

If you have a float in MSSQLServer, to what do you map this in .NET?

Can you convert it to Double or will you lose numbers?

6条回答
  •  执笔经年
    2020-12-30 20:20

    SQLServer float and C#/VB double have the same representation. This is the correct mapping. What you don't want to do is map SQL Server float to C#/VB float as that may involve a loss of precision. SQL Server real maps onto C#/VB float.

    T-SQL float and real type definitions can be found at MSDN. C# double definition can be found at MSDN as well, as can the float definition.

提交回复
热议问题