我在 Visual Studio 2008 中使用 Crystal 报表。在我的项目中,我有一个包含内部子报表的报表。我使用 Crystal 报表查看器来显示我的报表。当我在 Visual Studio Debug模式下运行网站时,它的所有工作都非常顺利,我的报告显示正确。
但是当我在 IIS(版本 8.5,Windows 10 Dev Preview)上设置我的网站(也在开发 PC 上)时,我的报告没有显示,它要求主报告和子报告之间的参数链接。
任何人都可以告诉我有什么问题以及如何解决这个问题? 非常感谢。
这是我在 Report viewer 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;
}
}
最佳答案
谢谢大家。我的问题解决了。如果您需要答案,那是因为我的 PC 是 64 位基本操作系统,我只是在 IIS 应用程序池上“启用 32 位”然后它就可以工作了。
关于c# - 带有 IIS 的 Crystal 报表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27715712/