3
votes

I'm using crystal report in Visual Studio 2008. In my project, I have a report with internal subreport. I use a crystal Report Viewer to show my report. All its work very well when I running website in Visual Studio debug mode, my report shown correctly.

But when I setup my website (on develop PC too) on IIS (Version 8.5, Windows 10 Dev Preview), my report doesn't show and it ask for parameters links between main report and subreport.

Anyone can tell me what are problems and how to resolve this? Thanks so much.

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

And this one when I run in IIS localhost

Here is my code on 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;

    }
}
1

1 Answers

3
votes

Thanks for all. My problem was resolved. If you need answer, it's my PC is 64bit base OS, I've just "Enable 32 bit" on IIS Application Pool then it works.