Solved

Crystal Reports viewer Blank in production

Posted on 2012-04-10
12
805 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 101

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 101

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

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
 
LVL 101

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 101

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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

623 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