Leading zero(s) for numeric or string type variable not saved in database.

mozaharul

Active Member
Licensed User
Hi,
I tried to save in database value (digit) with leading zero(s) for “numeric” and “string” type variable but I found that the zero(s) are dropped for both type of variables and only the digit part are saved. The control I use to input digits is Textbox, What is the mistake am I doing ?


Regards,
 

derez

Expert
Licensed User
Longtime User
It all depends on what you do with the data you take from the textbox, since it is usually kept as string.
Example - if you tell another textbox to show the content of this textbox - it will be the same (with the zeroes).
If you do a math operation - the data will be changed to numeric.
Example - textbox1.text + 0 will result a number without leading zeroes.
copying to a table keeps the leading zero:
table1.Cell("Col1",rownumber) = textbox1.Text

So if you'll tell us what you do with it - will be able to help (maybe).
 
Top