在数据库中浮动?在.NET中 [英] Float in Database to ? in .NET
问题描述
如果您在MSSQLServer中有一个浮点数,那么在.NET中如何映射?
If you have a float in MSSQLServer, to what do you map this in .NET?
您可以将其转换为Double还是丢失数字? p>
Can you convert it to Double or will you lose numbers?
推荐答案
SQLServer float
和C#/ VB double
具有相同的表示。这是正确的映射。你不想做的是将SQL Server float
映射到C#/ VB float
,因为可能会导致丢失的精度。 SQL Server real
映射到C#/ VB float
。
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
.
可以在 MSDN 找到T-SQL浮点数和真实类型定义。 C#双重定义也可以在 MSDN 中找到,浮点数也可以定义。
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.
这篇关于在数据库中浮动?在.NET中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!