This topic is locked
[SOLVED]

 syntax to format integer to string "000000"

3/27/2015 1:30:39 PM
ASPRunner.NET General questions
M
mroman98 author

Hi Forum,
How can i get the formatting of an integer (1234) to string (001234)...

I've tried what i know and nothing happens or i get an error CS1501...
this is the syntax that I've tried last
value = String.Format("{0:000000}", data["EmployeeID"]);
it doesn't do anything .
Regards,

Manuel Roman

admin 4/27/2015

Assuming that your database is SQL Server modify SQL query this way:

SELECT ...

REPLACE(STR(EmployeeID, 6), SPACE(1), '0') AS PaddedEmployeeID

from ...