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
472.7k
Cannot be constructed to Linq
Jul 22 2020 6:55 AM
Hi Team
I am experience this problem below and my table definition is as follows;
// Model
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
; }
}
// Controller
public
ActionResult Download_XMLReport()
{
var _db =
new
eNtsaRegistration();
var data = (from q
in
_db.Training select
new
eNtsaRegForm {
FirstName = q.FirstName
}).ToList();
// Error is here it can not be constructed to Linq
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
;
//return View();
}
}
Reply
Answers (
1
)
Razor pages single field SQL Server update
I want to add ' Mark for review option ' in a Online Exam Project