TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
474.6k
CyrstalReport DataSet doe not support Nullable?
Jul 20 2020 4:56 AM
Hi Team
I have a controller and getting an error "DataSet does not support System.Nullable" How can i solve this issue?
// Controller
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"
);
}
// Model DbContext
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);
}
}
// Table-Definition
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
; }
}
Reply
Answers (
1
)
Reference checkbox within db using asp.net mvc
How to strone login user session id in database table?