john kanyora

john kanyora

  • NA
  • 242
  • 46.5k

formatting numbers to currency

Dec 15 2017 3:23 AM
am having trouble formating my numbers to currency..am drawing a bar chart and i want to have the numbers in the form of currency.what am getting is just integers for example instead of getting 200.00 am getting just 200.below is my code`
 
string connect=TraceBizCommon.Configuration.ConfigSettings.ConnectionString;
SqlConnection conn = new SqlConnection(connect);
conn.Open();
SqlCommand cmd = new SqlCommand("select substring(Customer, 1,8),[Total Amount] from CustomerDebts ", conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
string[] x = new string[dt.Rows.Count];
decimal[] y = new decimal[dt.Rows.Count];
for (int i = 0; i
{
x[i] = dt.Rows[i][0].ToString();
y[i] = Convert.ToInt32(dt.Rows[i][1]);
}
BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y});
BarChart1.CategoriesAxis = string.Join(",", x);
BarChart1.ChartWidth =500.ToString();//(x.Length * 100).ToString();
BarChart1.ChartHeight = 600.ToString();//(y.Length * 75).ToString()`

Answers (12)