M. rit M. rit - 1 year ago 70
SQL Question

Send 16 digits number to SQL db

I need to send a 16 digit number through C# form to my SQL database.
In which method should i use and how?
(Int,decimal,long,double etc.)
(Im using ms visual studio and ms access both 2012)
**edit: I used decimal and it works but it hash it in the db but when the pointer is on him it reveal the num. Any suggests how to solve it?

Answer Source

C# has these numeric types:

short.MaxValue:  32767
short.MinValue: -32768
ushort.MaxValue: 65535
ushort.MinValue: 0
int.MaxValue:    2,147,483,647
int.MinValue:   -2,147,483,648
uint.MaxValue:   4,294,967,295
uint.MinValue:   0
long.MaxValue:   9,223,372,036,854,775,807
long.MinValue:  -9,223,372,036,854,775,808

And these decimal types:

Float - 32 bit (7 digits)
Double - 64 bit (15-16 digits)
Decimal - 128 bit (28-29 significant digits)

Since you need 16 digits, go with long. Unless you need to support decimal. In that case, use double or decimal. Decimal is much more precise because double will round your value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download