using CrystalDecisions.CrystalReports.Engine;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP;Initial Catalog=TestDB;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportDocument doc = new ReportDocument();
doc.Load(Server.MapPath("~/UserList.rpt"));
DataSetSample ds = getdata();
doc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = doc;
}
}
public DataSetSample getdata()//.xsd file
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from tblUser", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSetSample ds = new DataSetSample();
da.Fill(ds, "DataTable1");
return ds;
}
}
我正在手动使用水晶报表。这是我的 .cs 文件代码。代码显示没有错误,但在浏览器上显示空白网页。找不到错误......