Solved

Crystal Reports viewer Blank in production

Posted on 2012-04-10
12
767 Views
Last Modified: 2012-04-18
I have a report that works correctly in development but in production displays a blank page.
built in Visual Studios 2010.

I receive no Errors


string reportPath = Server.MapPath("~/Reports/" + _reportData.ReportNameCR);
rptReport.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
WebMsgBox.Show(_reportData.ReportDataset.Tables[0].Rows.Count.ToString()); // this pops an alert box that shows the correct row count
rptReport.SetDataSource(_reportData.ReportDataset);
crReportViewer.ReportSource = rptReport;
crReportViewer.DataBind();

Open in new window


the WebMsgBox.Show line pops an alert box.  if I move this after
rptReport.SetDataSource(_reportData.ReportDataset);

Open in new window

then it never pops.  So it is something to do with the setDataSource, but i am stumped

the production server is windows 2008 r2 sp1
0
Comment
Question by:jfb1126
  • 7
  • 5
12 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37830931
Is this against the same database as you developed it?

mlmcc
0
 

Author Comment

by:jfb1126
ID: 37834849
it is a local copy of the same DB.  the data there is the same.  the site is connecting to the db fine.  as mentioned above, I put an alert telling me the # of records, so I know the Dataset is populated.  it appears to hang when I invoke the SetDataSource method.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37834949
SO when you run from within VS2010 it is using a local database and when run on the web it uses a different database?

How are you loading the dataset?

Was the report built using a recordset or built against a database?

mlmcc
0
 

Author Comment

by:jfb1126
ID: 37834990
the dataset is loaded through the business object.  the report was built against an XSD file.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37835066
If you put a webmsgbox after that line you never see it?

I don't use that version so I don't know what the issue is.

mlmcc
0
 

Author Comment

by:jfb1126
ID: 37835522
Nope, the message box never shows after the SetDataSource()  

thanks for trying.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 100

Expert Comment

by:mlmcc
ID: 37835600
How is rptReport declared?

mlmcc
0
 

Author Comment

by:jfb1126
ID: 37835634
here's the full code.  the report name and any parameters (and parameter Types) are passed into the page.  

ReportData is my business object that loads the dataset.  


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using GranitizeWarehouseDataObjects;
using Tools_jfb;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;
using CrystalDecisions.CrystalReports.Engine;

namespace GranitizeWarehouseWebsite
{
    public partial class ReportViewer : GranitizePage
    {
        private ReportData _reportData;
        private ReportDocument rptReport;
        private String rptName;
        private String ThisPage;
        private Boolean QuickPrint;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                rptReport = new ReportDocument();
                ThisPage = "http://" + Request.ServerVariables["SERVER_NAME"] + Request.ServerVariables["URL"] + "?" + Request.QueryString;


                if (Request["report"] == null)
                    throw new ArgumentException("Report Not Set");
                else
                    rptName = (String)Request["report"];

                this.Title = "Granitize S.O.S. - " + Request["report"];
                _reportData = new ReportData(rptName, CurrentUser);

                //Setup Navigation Links
                String http_Referrer = "";
                http_Referrer = Request.ServerVariables["http_referer"];
                if (http_Referrer != null)
                {
                    if (http_Referrer.IndexOf("ReportViewer") == -1)
                        Session["HTTP_REF"] = Request.ServerVariables["http_referer"];
                }
                linkBack.NavigateUrl = (String)Session["HTTP_REF"];
                if (_reportData.ReportNameCR == "reportPickingSheets.rpt")
                {
                    linkOther.Text = "Continue Processing ->";
                    linkOther.NavigateUrl = "~/EditWhsOrderStatus.aspx?ParamValues=" + Request["ParamValues"];
                    linkOther.Visible = true;
                }

                _reportData.loadPrarameters(Request["ParamName"], Request["ParamValues"], Request["objType"]);
                _reportData.Fill();


                if (Request["C"] == "1")
                {
                    _reportData.ReportDataset.DataSetName = rptName + "_DS";
                    WriteReportSchema(_reportData.ReportDataset);
                }
                else
                {

                    string reportPath = Server.MapPath("~/Reports/" + _reportData.ReportNameCR);
                    rptReport.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
                    WebMsgBox.Show(_reportData.ReportDataset.Tables[0].Rows.Count.ToString());
                    rptReport.SetDataSource(_reportData.ReportDataset);
                    crReportViewer.ReportSource = rptReport;
                    crReportViewer.DataBind();
                }

                if (Request["QuickPrint"] == "1")
                {
                    QuickPrint = true;
                }
            }
            catch (Exception ex)
            {
                //     Response.Write(ex.Message + "<br/><br/>" + ex.Source + "<br/><br/>" + ex.StackTrace + "<br/><br/>" + ex.Data + "<br/><br/>" + ex.InnerException);
                WebMsgBox.Show(ex.Message);
            }
        }//END Page Load
        protected void Page_Unload(object sender, EventArgs e)
        {   
            if (rptReport !=null)
                rptReport.Dispose();
            if (QuickPrint)
            {
                btnExport_Click(sender, e);
               /* System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("<script language=\"javascript\" type=\"text/javascript\">");
                sb.Append("window.opener.BackFromPopup();");
                sb.Append(@"self.close(); ");
                sb.Append(@"</script>");
                ClientScript.RegisterStartupScript(GetType(), "cwin", sb.ToString());*/
            }
        }
        private void ConfigureCrystalReports()
        {
        }

        public void WriteReportSchema(DataSet reportData)
        {
            String path = Server.MapPath("Reports/App_Code/");
            reportData.WriteXmlSchema(path + _reportData.FileName);
        }
       
    }//END CLASS
}

Open in new window

0
 

Author Comment

by:jfb1126
ID: 37838381
OK, I made a little progress, the report is loading now (I know this because I can now export it as before I could not), but the viewer still displays blank.

changed line
rptReport.SetDataSource(_reportData.ReportDataset);

Open in new window

to this:
 DataSet ds = _reportData.ReportDataset;
rptReport.SetDataSource(ds);

Open in new window

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37840858
Is there more than 1 page?

The viewer starts on page 1 which could be blank

mlmcc
0
 

Accepted Solution

by:
jfb1126 earned 0 total points
ID: 37843122
RESOLVED:

as described above, declaring a local dataset and setting it = to the one returned by my business object instead of using the business object directly worked to load the report

the non- display issue was resolved by putting a virtual directory on my website pointing to the crystal reports folder on my server
0
 

Author Closing Comment

by:jfb1126
ID: 37859695
I solved this myself
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now