[Help]Convert data type.

09/24/2013 15:24 thund22222#1
I have problem in converting data type in the C# language..
I have a table in SQL server has the data type columns is decimal(10.8) and I want to read through the table tool that you designed to help make the tool read decimal(10.8) what is the appropriate Data Type in the C# language
Knowing you experience Dicmal and Single and Double but are read incorrectly
09/24/2013 16:50 desTenshi#2
I think you should rewrite your post, so it's easier to understand.
Do you want to know which datatype you need to hold a number like 10.8? Or do you want to know how to convert the value of the tables?
What kind of datatype are the things you get out of the database? Strings?
Well if so, you could use Double.Parse(String value here) for example to convert it into a double.
09/24/2013 21:31 thund22222#3
This clarification

public Int32 id { get; set; } // Data type of the column in the sql = int
public Int32 drop_item_id_00 { get; set; } // Data type of the column in the sql = int
public Int64 drop_min_count_00 { get; set; } // Data type of the column in the sql = bigint
public Int64 drop_max_count_00 { get; set; } // Data type of the column in the sql = bigint
public Double drop_percentage_00 { get; set; } // Data type of the column in the sql = Decimal(10.8)

In other words, the data type int in sql is equivalent to int32 in C#
and data type bigint in sql is equivalent to int64 in C#
and data type decimal(10.8) in sql is equivalent to Double in C#? true or nor?

What is the equivalent decimal data in sql in c# language?
09/24/2013 22:25 Beni#4
There are in C#:
-Float
-Double
and
-Decimal.

They are different between their places after the , .

For eg:
Float:
7 Places after the , and numbers from -3,4 * 10^38 to 3,4 * 10^38.
-> That is: Float x = 1.0f /7
x = 0.1428571
Double:
Its 15-16 Places after the , and numbers between 5 * 10^324 to 1,7 * 10^308
-> That is the reason why u use double in most of time.
You can write too : double x = 1.0 / 7
=> X will be 0.14... with 15-16 places.
Decimal is from -7,9*10^28 to 7,9*10^28 and is good for 28-29 places after the , .
-> Decimal x = 1.0m / 7
=> 0.14... 29 places.

Double is good, cause you dont need that difficult Code and it has the highest range..

Hope i could help you, im nativ german, so my english es very very baaaad.

Best regards

To your question: i think its Decimal.

to the Code: You must get 1 Number in form like 5.0m (m for decimal, that everything is in decimal now, and the .0 to get the , and the mathematical right answer)
eg:
decimal x = 10/5
X=0
Decimal x = 10.0m/5
X=2