Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 13:22

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]Convert data type.

Discussion on [Help]Convert data type. within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2013
Posts: 159
Received Thanks: 14
[Help]Convert data type.

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
thund22222 is offline  
Old 09/24/2013, 16:50   #2
 
elite*gold: 0
Join Date: Sep 2013
Posts: 63
Received Thanks: 26
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.
desTenshi is offline  
Old 09/24/2013, 21:31   #3
 
elite*gold: 0
Join Date: May 2013
Posts: 159
Received Thanks: 14
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?
thund22222 is offline  
Old 09/24/2013, 22:25   #4
 
Beni's Avatar
 
elite*gold: 0
The Black Market: 171/0/0
Join Date: Jul 2009
Posts: 3,269
Received Thanks: 786
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
Beni is offline  
Reply


Similar Threads Similar Threads
Kick to convert: easy and fast way to convert your item_proto/mob_proto to txt files!
09/07/2016 - Metin2 PServer Guides & Strategies - 21 Replies
Hi all, this is my first release :) This "kick converter" will allow you to generate txt files (item_names, item_proto, mob_proto, mob_names) for the rev-34k game. The script was written in python by me, so you need python 2.7 and MySQLDB (python extension) installed on your server. If you found any error, please report it to me and I'll fix it as soon as possibile. PS: If you get errors while converting the item_proto, please remove items that have type 29 or type 31.
Search data type
10/26/2012 - C/C++ - 2 Replies
hi, im looking for a data type. this might sound a bit strange, so i will try to explain it to you. i want to write a dll for a game, which reads some memoryvalues. but strings are stored in a very weird way. if the length of the string is smaller than 7 the string is directly stored in the object. But if the length of the string is bigger than 6 it is stored as a pointer to the string.
[Help]Type and Data parameters for Tq Binary
08/19/2009 - CO2 Private Server - 10 Replies
I was wondering if someone can help me with Type and Data parameters in tq binarys and explain the action each one does,Help appreciated. :handsdown:
Need item type and token type boot
03/18/2008 - Conquer Online 2 - 1 Replies
Hi All programers and makers of boots, Great job. Could some one make item and token type boot for patch 5118. Please



All times are GMT +1. The time now is 13:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.