using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; public partial class demo2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt = new DataTable(); SqlConnection con = new SqlConnection(@"connectionString); SqlCommand cmd=new SqlCommand("select Name, Debit, Credit From aTable",con); SqlDataAdapter da=new SqlDataAdapter (cmd); da.Fill(dt); string[] x = new string[dt.Rows.Count]; decimal[] z = new decimal[dt.Rows.Count]; decimal[] y = new decimal[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { x[i] = dt.Rows[i][0].ToString(); y[i] = Convert.ToInt32(dt.Rows[i][1]); z[i] = Convert.ToInt32(dt.Rows[i][2]); } BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = y }); BarChart1.Series.Add(new AjaxControlToolkit.BarChartSeries { Data = z }); BarChart1.CategoriesAxis = string.Join(",", x); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)