Go Premium for a chance to win a PS4. Enter to Win

x
?

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

Posted on 2017-09-12
0
Low Priority
?
70 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
0 Comments

Featured Post

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!

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

927 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