I am experience this problem below and my table definition is as follows;
-
- public class eNtsaRegForm
- {
- [Key]
- public int Id { get; set; }
- public string Title { get; set; }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public string Position { get; set; }
- public string Company { get; set; }
- public string StreetAddress { get; set; }
- public string StreetAddressLine { get; set; }
- public string City { get; set; }
- public string StateProvince { get; set; }
- public int ZipCode { get; set; }
- public string Country { get; set; }
- public string Email { get; set; }
- [Required(ErrorMessage = " This field is required")]
- public int CellNumber { get; set; }
- public string DietaryRequirements { get; set; }
-
-
- }
-
-
- public ActionResult Download_XMLReport()
- {
- var _db = new eNtsaRegistration();
-
- var data = (from q in _db.Training select new eNtsaRegForm {
- FirstName = 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.PortableDocFormat);
- stream.Seek(0, SeekOrigin.Begin);
- return File(stream, "application/excel", "eNtsaRegistrationForm.excel");
- }
- catch
- {
- throw;
-
- }
-
-
- }
-