Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

Crystal report displays no data although the dataset was set using push method

$
0
0

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 show "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;
         }
     }

What I have tried:

- I added useLegacyV2RuntimeActivationPolicy="true" to app.config and then removed it but both did not work.
- I also removed all CrystalReportViewer from my UI.

Thanks !


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>