I have a field for storing laboratory results but i cannot decide which data-type i should chose. The most important thing for me is that i
do not want any automatic Decimal Conversion. I needto have the following “ what the user enter ,, is what it will be saved in the database and it will be what he see later”.
The laboratory results can varies in its format, such as:-
- 50.12
- 18000000.245
- - 30.56
- 90
So i cannot determine which datatype to use either ; decimal, float, double or even another data-type.
BR
Saving it as a string will make sure it will prevent any decimal conversions. Not sure if you use the number for any calculations so this may not work for you.
Sorry i did not mention that i am using the Result field for some calculation such as comparing if the result are (within , less than or exceed a certain level) -where these levels might also have fractions- , so string will not work i think. Any suggestions
johnjohn1231...
Participant
922 Points
871 Posts
What is the best data type to store laboratory results in my Sql server and entity framework?
May 06, 2012 05:40 PM|LINK
I have a field for storing laboratory results but i cannot decide which data-type i should chose. The most important thing for me is that i do not want any automatic Decimal Conversion. I needto have the following “ what the user enter ,, is what it will be saved in the database and it will be what he see later”.
The laboratory results can varies in its format, such as:-
- 50.12
- 18000000.245
- - 30.56
- 90
So i cannot determine which datatype to use either ; decimal, float, double or even another data-type.
BR
Ken Tucker
All-Star
16797 Points
2608 Posts
MVP
Re: What is the best data type to store laboratory results in my Sql server and entity framework?
May 06, 2012 05:57 PM|LINK
Saving it as a string will make sure it will prevent any decimal conversions. Not sure if you use the number for any calculations so this may not work for you.
Space Coast .Net User Group
johnjohn1231...
Participant
922 Points
871 Posts
Re: What is the best data type to store laboratory results in my Sql server and entity framework?
May 06, 2012 09:13 PM|LINK
Sorry i did not mention that i am using the Result field for some calculation such as comparing if the result are (within , less than or exceed a certain level) -where these levels might also have fractions- , so string will not work i think. Any suggestions
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: What is the best data type to store laboratory results in my Sql server and entity framework?
May 08, 2012 01:44 AM|LINK
Then I think you should define your SQL type is money,and in C# it should be converted to decimal(See the mapping types between .NET and SQL db's type:http://msdn.microsoft.com/en-us/library/4e5xt97a(v=vs.71).aspx)
And what's more,you should show it to the public by using string.Format function。
Hope this helps!
Reguards!