Solved

Crystal Reports viewer Blank in production

Posted on 2012-04-10
12
792 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
Independent Software Vendors: 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 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
 
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

Independent Software Vendors: 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!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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