unrecognized zeros in C# string format
-
Hi. I have an auto-increment database field with 5 digits. (example. "00001", "00002", "00003") But every time i query it using C#, and place it in text boxes or in labels, it always removes the zeros, so I always end up with just "1", "2", "3", etc. I'm currently using microsoft access 2003. The error also occurred when I used mySQL. Anyone know how to set form objects to recognize the zeros in the values? Thanks in advance.
-
Hi. I have an auto-increment database field with 5 digits. (example. "00001", "00002", "00003") But every time i query it using C#, and place it in text boxes or in labels, it always removes the zeros, so I always end up with just "1", "2", "3", etc. I'm currently using microsoft access 2003. The error also occurred when I used mySQL. Anyone know how to set form objects to recognize the zeros in the values? Thanks in advance.
Its only an error if the value is a string. If it's a number at any point in the process, the 0s are meaningless, and therefore discarded. You can use string.Format to format a string to have as many zeros as it needs to fit this format.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )