Load Report Failed
Page 1 of 1
Re: Load Report Failed
Following document help me to resolve my issue Solve Error
Crystal Report Document needs to be manually disposed.You need to close Report document. It actually creates temprary files in Windows Temp Folder
You should control the lifetime of all Reports in your application and call their Dispose before reaching the 75 limit.
Crystal Report Document needs to be manually disposed.You need to close Report document. It actually creates temprary files in Windows Temp Folder
You should control the lifetime of all Reports in your application and call their Dispose before reaching the 75 limit.
Load Report Failed
- Code:
public ActionResult OccupiedReport()
{
List<ReservationModel.OccupiedStatus> Occupied = new List<ReservationModel.OccupiedStatus>();
string constr = ConfigurationManager.ConnectionStrings["MyCnn"].ConnectionString;
using (MySqlConnection con = new MySqlConnection(constr))
{
string query = "SELECT * FROM room_status WHERE check_out >= CURDATE() and status ='occupied'";
using (MySqlCommand cmd = new MySqlCommand(query))
{
cmd.Connection = con;
con.Open();
using (MySqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
Occupied.Add(new ReservationModel.OccupiedStatus
{
DormName = sdr["Dorm_Name"].ToString(),
RoomNumber = sdr["Room_Number"].ToString(),
BedNumber = sdr["Bed_Number"].ToString(),
GuestName = sdr["Guess_Name"].ToString(),
Classification = sdr["Classification"].ToString(),
Gender = sdr["Gender"].ToString(),
CheckIn = sdr["Check_In"].ToString(),
CheckOut = sdr["Check_Out"].ToString(),
StatusType = sdr["Status"].ToString()
});
}
}
con.Close();
ReportDocument rd = new ReportDocument();
rd.FileName = Server.MapPath("/CrReport/CrystalReport1.rpt");
rd.Load(Server.MapPath("~/CrReport/CrystalReport1.rpt"));
rd.SetDataSource(Occupied);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "CustomerList.pdf");
}
}
}
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|