Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?

Crystal report display no data although the DataSet is set using push method

Posted on 2017-09-12
0
Low Priority
?
29 Views
Last Modified: 2017-09-12
I'm new to crystal report. I'm facing an issue that my report show no data although the dataset showed it did have data during debugging. I noticed that everything went wrong after the line " m_rptViewReport.SetDataSource(ds); ", it showed "HasRecords = Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation crystal reports" Basically, I'm trying to export the data to xls file using push method. I'm using VS2015 and my crystal report assembly version is 13.0.3500.0

Pls take a look at my code
 public bool ExportToFile(DataSet ds,string fileType)
     {
         try
         {
             object obj = null;
             char[] split ={ '.' };
             CrystalDecisions.CrystalReports.Engine.ReportDocument m_rptViewReport = null;


                 if (File.Exists(Request.PhysicalApplicationPath + "\\" + this.ReportFile))
                 {
                    try { 
                     m_rptViewReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                     m_rptViewReport.Load(Request.PhysicalApplicationPath + "\\" + this.ReportFile);

                        ds.WriteXml("D:\\testfile.XML", XmlWriteMode.WriteSchema); //the output XML file does have data
                        m_rptViewReport.SetDataSource(ds);//something went wrong after this line
                    }
                    catch (Exception ex) //nothing happened here
                    {
                        throw ex;
                    }
                 }
                 else
                     this.SetTextTitle(Resources.GetLanguage("msgNoFile") + " " + this.ReportFile);

             if (m_rptViewReport.HasRecords){ //I added this line later and founded that the value is not TRUE
             if (m_rptViewReport != null)
             {
                SetReportParameterValue(m_rptViewReport);

                        Response.ContentType = "application/vnd.ms-excel";

                        try {
                            m_rptViewReport.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.Excel, Response, true, this.ReportCode);

                        }
                        catch (System.Threading.ThreadAbortException ex1)
                        {
                            //throw ex1;
                        }

             }
            }
            return true;
         }
         catch(Exception ex)
         {
            return false;
         }
     }

Open in new window


any help would be appreciated.
Thanks !
0
Comment
Question by:Vu P
[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
0 Comments

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 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