Solved

Crystal Reports viewer Blank in production

Posted on 2012-04-10
12
751 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

16 Experts available now in Live!

Get 1:1 Help Now