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" />
-
-
-
- public class ReportsMaster : IlReports
- {
- public DataSet Generate_AdvertDetailsReport()
- {
- using(SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["eNtsaOnlineRegistrationDB"].ToString()))
- {
- con.Open();
- DataSet ds = new DataSet();
-
-
- 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();
- }
- }
- }
- }
- }