Hi Team
I have a controller and getting an error "DataSet does not support System.Nullable" How can i solve this issue?
-
- public ActionResult Download_XMLReport()
- {
- eNtsaRegistration context = new eNtsaRegistration();
-
- ReportDocument rpt = new ReportDocument();
- rpt.Load(Path.Combine(Server.MapPath("~/Reports"), "AcademyReports.rpt"));
- rpt.SetDataSource(db.TrainingRegs.ToList()); // DataSet Does not support system.nullable??
- Response.Buffer = false;
- Response.ClearContent();
- Response.ClearHeaders();
-
- rpt.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
- rpt.PrintOptions.ApplyPageMargins(new CrystalDecisions.Shared.PageMargins(5, 5, 5, 5));
- rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA5;
-
- Stream stream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
- stream.Seek(0, SeekOrigin.Begin);
-
-
-
-
- return File(stream, "application/xml", "eNtsaReportTrainingForm.xml");
- }
-
-
- public class eNtsaRegistration:DbContext
- {
-
- public eNtsaRegistration() : base("eNtsaRegistration")
- {
- } public DbSet<TrainingRegForm> TrainingRegs { get; set; }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- Database.SetInitializer<eNtsaRegistration>(null);
- base.OnModelCreating(modelBuilder);
- }
- }
-
- public class TrainingRegForm
- {
- [Key]
- public Guid? 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 Email { get; set; }
-
- [Required(ErrorMessage = "This field is required")]
- [DataType(DataType.PhoneNumber)]
- public string CellNumber { get; set; }
- public string DietaryRequirement { get; set; }
- }