Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to save my double number in database in this way:

if I have '1' I want to write '01'
if I have '0' I want to write '00'

how must I do?

What I have tried:

now in my database if I must write '01', my software writes '1'
Posted
Updated 4-Jun-24 4:56am
v2

1 solution

That is totally the wrong way to do it. You only need the leading zeroes or decimal places when you want to display the number somewhere. Internally you should always keep it as its proper value type - in your case stored as a Double type.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900