我的代码似乎有什么问题?我无法在浏览器中查看它。我搜索了谷歌,但找不到答案。已经2天了,我正在寻找解决方案。谁能帮忙谢谢。
public partial class WebForm1 : System.Web.UI.Page
{
string connectionString = "server=" +
ConfigurationManager.AppSettings["Server"] + ";uid=" +
ConfigurationManager.AppSettings["User ID"] + ";pwd=" +
ConfigurationManager.AppSettings["Password"] + ";database=" +
ConfigurationManager.AppSettings["Database Name"] +
";Command Timeout=28800;";
protected void Page_Load(object sender, EventArgs e)
{
EmpReport crystalReport = new EmpReport();
dsEmp ds = GetData();
crystalReport.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource = crystalReport;
this.CrystalReportViewer1.RefreshReport();
}
private dsEmp GetData()
{
string query = "SELECT * FROM emp_table";
MySqlConnection con = new MySqlConnection(connectionString);
MySqlCommand cmd = new MySqlCommand(query);
MySqlDataAdapter da = new MySqlDataAdapter();
cmd.Connection = con;
da.SelectCommand = cmd;
dsEmp ds = new dsEmp();
da.Fill(ds, "DataTable1");
return ds;
}
}
答案 0 :(得分:0)
通过将C:// inetpub / wwwroot / aspnet_client / system_web中找到的4_0_30319文件夹放入项目的根文件夹中,我可以显示Crystal报表。还要确保在项目文件(Web.config)中配置正确。