B
BrassicaNigra
Greetings,
I am writing an application that prepares a quotation for a customer. The
calculations are done in a SQL Server stored procedure. I use a datareader
to fetch the record, but cannot seem to get the data to format correctly.
Since it is a quote I want the data in the format 12.34. Everything seems
fine, except when I have a a zero at the end of the price, then I get 12.3.
It needs to be 12.30.
When I set the textbox value using the datareader I was using the ToString()
function to convert the data from a floating point to a string. Usually when
I do this I can apply a format string as an argument (i.e. ToString("F2")).
When I use the ToString method of the datareader it does not allow for any
arguments.
Can't seem to find any information about this. I have spent more time
trying to format these prices than I have writing the entire application.
What happened to simple data formatting (like the old sprintf())?
Help!
Dale Hoffman
I am writing an application that prepares a quotation for a customer. The
calculations are done in a SQL Server stored procedure. I use a datareader
to fetch the record, but cannot seem to get the data to format correctly.
Since it is a quote I want the data in the format 12.34. Everything seems
fine, except when I have a a zero at the end of the price, then I get 12.3.
It needs to be 12.30.
When I set the textbox value using the datareader I was using the ToString()
function to convert the data from a floating point to a string. Usually when
I do this I can apply a format string as an argument (i.e. ToString("F2")).
When I use the ToString method of the datareader it does not allow for any
arguments.
Can't seem to find any information about this. I have spent more time
trying to format these prices than I have writing the entire application.
What happened to simple data formatting (like the old sprintf())?
Help!
Dale Hoffman