[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Open
  • Priority: Low
  • Security: Public
  • Views: 89
  • Last Modified:

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

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
Vu P
Asked:
Vu P
0 Comments

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now