开发者

inserting piechart to a crystal report

开发者 https://www.devze.com 2023-03-02 23:40 出处:网络
I am working in c#.I want to createcrystal reports which need a pie chart to show on that report. So can u just tell me (procedure or any example or any link )that how to inserta graph to a crystal re

I am working in c#.I want to create crystal reports which need a pie chart to show on that report. So can u just tell me (procedure or any example or any link )that how to insert a graph to a crystal report.

eg. suppose there r some courses and their particular batches. Batches have their particular no of students. Show a pie chart based on batches with no of students of a particular course. given that all the values are from the same table.

On btn_click()

{   
            SqlConnection cnn;
            string connectionString = null;
            st开发者_如何学Goring sql = null;
            connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=EMS;User ID,password=";

            cnn = new SqlConnection(connectionString);
            cnn.Open();
            sql = "query";

            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
            DataSet1 ds = new DataSet1();
            dscmd.Fill(ds, "names");
            cnn.Close();
            CrystalReport1 objRpt = new CrystalReport1();
            objRpt.SetDataSource(ds.Tables[1]);
            CrystalReportViewer1.ReportSource = objRpt;
            CrystalReportViewer1.RefreshReport();    
}


Right Click in blank area of Report Designer and then Insert and then click Chart option. In the Type tab and from chart type list select Pie Option or any another type of Chart.

0

精彩评论

暂无评论...
验证码 换一张
取 消