【发布时间】:2014-12-31 03:20:56
【问题描述】:
我在 Visual Studio 2008 中使用水晶报表。在我的项目中,我有一个带有内部子报表的报表。我使用水晶报表查看器来显示我的报表。当我在 Visual Studio 调试模式下运行网站时,它的所有工作都非常好,我的报告显示正确。
但是当我在 IIS(版本 8.5,Windows 10 Dev Preview)上设置我的网站(也在开发 PC 上)时,我的报告没有显示,它要求主报告和子报告之间的参数链接。
谁能告诉我什么是问题以及如何解决这个问题? 非常感谢。
这是我在报告查看器 webcontrol 上的代码
protected void Page_Load(object sender, EventArgs e)
{
int xid = 0;
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.Params["preUrl"].ToString()))
{
previousUrl = Request.Params["preUrl"].ToString();
}
}
if (!string.IsNullOrEmpty(Request.Params["pxid"].ToString()))
{
xid = Convert.ToInt16(Request.Params["pxid"].ToString());
}
GetDatasource(xid);
theReport = new ReportDocument();
theReport.Load(Server.MapPath("~/Report/Test.rpt"));
theReport.SetDataSource(ds);
CrystalReportViewer1.ReportSource = theReport;
firstload = 1;
}
protected int firstload
{
get { return (int?)ViewState["firstload"] ?? 0; }
set { ViewState["firstload"] = value; }
}
protected void GetDatasource(int xid)
{
if (firstload == 0)
{
//dsReportSanxuat ds = new dsReportSanxuat();
SqlDataAdapter sAdp = new SqlDataAdapter();
SqlDataAdapter sAdpDu = new SqlDataAdapter();
ds = new dsReportSanxuat();
sAdp = oreport.GetReportSanxuatAdp(xid);
sAdpDu = oreport.GetReportSanxuatDuAdp(xid);
sAdp.Fill(ds, "dtReportSanxuat");
sAdpDu.Fill(ds, "dtReportDu");
firstload = 1;
}
}
protected dsReportSanxuat ds
{
get {
return (dsReportSanxuat)ViewState["ds"];
}
set
{
ViewState["ds"] = value;
}
}
【问题讨论】:
标签: c# asp.net iis crystal-reports