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.5k
CrystalDecisions.Shared.CrystalReportsException
Feb 18 2020 11:18 PM
Hi Mates
I am getting an exception to my Load() method, i am using CrystalDecision for reporting. Any one who can help me with this issue?
[HttpPost]
[ValidateAntiForgeryToken]
public
ActionResult AdvertReport(FormCollection fc)
{
DataSet ds = obIlReports.Generate_AdvertDetailsReport();
ds.Tables[0].TableName =
"Tbl_TrainingAcademy"
;
if
(ds.Tables[0].Rows.Count > 0)
{
ReportClass rptH =
new
ReportClass();
rptH.FileName = Server.MapPath(
"~/Reports/AdvertReport.rpt"
);
rptH.Load();
rptH.SetDataSource(ds.Tables[0]);
Response.Buffer =
false
;
Response.ClearContent();
Response.ClearHeaders();
Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return
File(stream,
"application/pdf"
,
"AdvertReport.pdf"
);
}
return
View();
}
}
"eNtsaOnlineRegistrationDB"
connectionString=
"Data Source=GcobaniM-L\SQLEXPRESS; DataBase=eNtsaOnlineRegistrationDB; Integrated Security=True"
providerName=
"System.Data.SqlClient"
/>
//IReport
public
class
ReportsMaster : IlReports
{
public
DataSet Generate_AdvertDetailsReport()
{
using
(SqlConnection con =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"eNtsaOnlineRegistrationDB"
].ToString()))
{
con.Open();
DataSet ds =
new
DataSet();
// Handling Exception
try
{
SqlCommand cmd =
new
SqlCommand(
"dbo.GetAdvertReport"
, con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da =
new
SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds);
if
(ds.Tables.Count > 0)
{
return
ds;
}
else
{
return
ds =
null
;
}
}
catch
(Exception )
{
throw
;
}
finally
{
ds.Dispose();
}
}
}
}
}
Reply
Answers (
2
)
How to write membership registration and authentication code
How to sync local server database to cloud server database