c# - 带有 IIS 的 Crystal 报表

标签 c# asp.net iis crystal-reports

我在 Visual Studio 2008 中使用 Crystal 报表。在我的项目中,我有一个包含内部子报表的报表。我使用 Crystal 报表查看器来显示我的报表。当我在 Visual Studio Debug模式下运行网站时,它的所有工作都非常顺利,我的报告显示正确。

但是当我在 IIS(版本 8.5,Windows 10 Dev Preview)上设置我的网站(也在开发 PC 上)时,我的报告没有显示,它要求主报告和子报告之间的参数链接。

任何人都可以告诉我有什么问题以及如何解决这个问题? 非常感谢。

This is screen when I run with visual studio debug mode, it work well

And this one when I run in IIS localhost

这是我在 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/

相关文章:

iis - QNetworkManager 是否默认接受压缩回复?

c# - 如何使用 C# 密码学检索签名哈希算法友好名称?

C# Lambda 返回语句问题

asp.net - 在 TextChanged 上停止回发

asp.net - 如何在不切换到 IIS 的情况下将 SSL 证书附加到我的 asp dot net 网站?

iis - 带有 iis 的多个 ssl

c# - 百分位数计算

c# - P/Invoke C++ 函数后清理内存

javascript - 获取图像按钮上 <a> 标记中的文本 单击

iis - 客户端 cname 指向我在 cloudflare 上的域