Convert a Decimal field to a String Value.


hello everyone,

i writing application in c#, using sql database, sql table. 1 column is  "decimal (5,0) need convert string value. rows have 3 or 4 space number, no decimals....i need 5 space string zero's leading make 5 spaces.

i know how use tostring method, trying figure out how add leading zero's

thank can give


dennis downey

here c# code on decimal.

decimal myvalue = 18.5m; myvalue.tostring().paddleft(5,'0');

edit:

if want more specific can refer page: standard numeric format strings

for example, if wanted show currency or wanting append culture information number represented in correct format depending on culture.


mark answer or vote helpful if find useful | igor




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'