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?
- public ActionResult Download_ExcelReport()
- {
-
-
- var data = (from q in db.eNtsaRegForms select new {
- Id = q.Id,
- FirstName = q.FirstName!=null?q.FirstName:""
-
- }).ToList();
-
- ReportDocument rpt = new ReportDocument();
- rpt.Load(Server.MapPath("~/Reports/uYiloReporting.rpt"));
- rpt.SetDataSource(data);
-
-
- Response.Buffer = false;
- Response.ClearContent();
- Response.ClearHeaders();
-
- try
- {
- Stream stream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
- stream.Seek(0, SeekOrigin.Begin);
- return File(stream, "application/vnd.ms-excel", "eNtsaRegistrationForm.xls");
- }
- catch
- {
- throw;
- return View();
- }
-
-
- }