Question on Forms and Format

melegant

Well-known member
Joined
Feb 2, 2003
Messages
52
Location
NY
I have an app that has a form that has some text boxes that display some numbers that i fill by querying a sql database and using a datreader etc...

now, on my pc and laptop that has VS, any number with a decimal will appear like so

5.5

or

5

now, on any other machine

it appears like this

5.0000

the datatypes in sql range from smallmoney, money and decimal.

why is this happening? it is creating havoc on my stored procedures where i did not plan for 4 decimal places.
thanks!
 
The precision and scale in numeric data types are fixed, except for DECIMAL (from sql server 2000 help, index search for scale of data type). To change the precision of a DECIMAL value;

ALTER TABLE tablename ALTER COLUMN columnname DECIMAL (precision , scalar) NULL | NOT NULL

Are you using the ToString for the value from the database. This would return the number of decimals in the scale value (4 for MONEY)? Use Format to format the number how you want it.
 
Back
Top