如何在ASP.NET中显示水晶报表

问题描述:

嗨..

我需要使用水晶报告显示报告,我是网络新手,所以请帮助我

我尝试了一些东西但是,当我'我正在运行我的代码它没有显示任何内容。



我尝试过:



Hi..
I need to display report using crystal reports, i'm new to net,so please help me
I tried something but, when i'm running my code it's displaying nothing.

What I have tried:

ReportDocument reportdocument = new ReportDocument();
       reportdocument.Load(Server.MapPath("~/CrystalReport2.rpt"));

       DataSet1 dsPersonInfo = new DataSet1();
       SqlConnection con = new SqlConnection("Data Source=localhost;user id=sa; password=sa;Initial Catalog=test;");

       con.Open();

       SqlCommand cmd = new SqlCommand("select * from PersonInfo", con);
       SqlDataAdapter da = new SqlDataAdapter(cmd);
       da.Fill(dsPersonInfo, "PersonInfo");
       con.Close();



       reportdocument.SetDataSource(dsPersonInfo);
       CrystalReportViewer1.ReportSource = reportdocument;

       CrystalReportViewer1.DataBind();







PersonInfo

是数据集DataTable名称





谢谢

is Dataset DataTable Name


Thanks

希望这是useul,

使用其功能组逐步创建Crystal Report,图表,交叉表和子报表 [ ^ ]
Hope this is useul,
Step by Step Creation of Crystal Report using its Features Group, Graph, Cross-Tab and Sub Report[^]