Problems with saving a number

sven2

Registered User.
Local time
Today, 19:07
Joined
Apr 28, 2007
Messages
297
Hello,

in a old database we have a field called "number" that is type integer.
Now when somebody puts in the number 012 the database save this as 12.

Is there a way to change this so that is save 012 without changing the type?

Thanks in advance,
Sven.
 
012 is not an integer (although a number theory person might wish to debate that), so it would be impossible to store it as an integer.

But assuming you want the values in your "Number" field to be easily calculated, then leave the Data Type as-is and simply apply the formatting you wish in the form control's Format property. That way it is always displayed according to your needs, but is stored efficiently as an integer.

Some other questions you might want to ask yourself would be "What is the purpose of these values? Why does the user input leading zeros for this field?"

HTH,
John
 

Users who are viewing this thread

Back
Top Bottom