Possibly save 1 hour of your time: There are times where you have to do some calculations on your data in .NET. If the data are based on different data types such as float, double or decimal, you will get error when you do calculations and storing the result in a certain datatype.
The best is to find out which of these fields have the most precision required or basically what is the biggest number possible.
Float, Double, Decimal is the biggest from the left to right respectively.
In my case, there are some big numbers so I just store them as decimals in both .NET and SQL.
Here is a good explanation on how SQL datatypes map to .NET datatypes:
(SQL -> .NET)
float -> double
decimal -> decimal
Error: System.InvalidOperationException : The specified cast from a materialized ‘System.Double’ type to the ‘System.Decimal’ type is not valid.
This happens when my SQL datatype is float but in .NET the datatype is decimal. Since I need to do calculations using divide operator, I will change SQL datatype from float to decimal(30,15).