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文件代碼。代碼顯示沒有錯誤,但在瀏覽器上顯示空白網頁。無法找到錯誤......Crystal Report在Crystal Report Viewer中未顯示數據使用VS 2013
先生我有最新版本,它在嚮導水晶報告中工作,但不能手動工作 – Haroon
@Haroon將你的代碼放在try和catch塊中,看看你面對的是哪個錯誤。 –