Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472.7k

CrystalReport is blank with no data?

Aug 5 2020 4:29 AM
Hi Team
 
I have created a crystal report, but the issue its empty there is no data. While i check from the column with the database there is a record. Please help mates, what could be the reason for this irregularity?
  1. public ActionResult Download_ExcelReport()  
  2.         {  
  3.             //var _db = new eNtsaRegistration();  
  4.   
  5.             var data = (from q in db.eNtsaRegForms select new {   
  6.             Id = q.Id,  
  7.             FirstName = q.FirstName!=null?q.FirstName:""  
  8.               
  9.             }).ToList();  
  10.   
  11.             ReportDocument rpt = new ReportDocument();  
  12.             rpt.Load(Server.MapPath("~/Reports/uYiloReporting.rpt"));  
  13.             rpt.SetDataSource(data);  
  14.   
  15.   
  16.             Response.Buffer = false;  
  17.             Response.ClearContent();  
  18.             Response.ClearHeaders();  
  19.   
  20.             try  
  21.             {  
  22.                 Stream stream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);  
  23.                 stream.Seek(0, SeekOrigin.Begin);  
  24.                 return File(stream, "application/vnd.ms-excel""eNtsaRegistrationForm.xls");  
  25.             }  
  26.             catch  
  27.             {  
  28.                 throw;  
  29.                 return View();  
  30.             }  
  31.   
  32.              
  33.         }  
 

Answers (4)