Debi
8/22/2006 3:38:00 PM
Hi,
I tried to implement caching for a crystal report using the Cache
object. Just assign to cache and set expiry. But as soon as the
reportdocument is disposed in Page Unload, the cached report also becomes
null. Can anyone help me please?
Has anyone successsfully used a cached report. I don't see any good
examples on caching. I tried to use ICachedreport but couldn't find any
examples on setting parameters for the cached report.
Any input is appreciated.
Thanks,
Debi
*****************************************
if ((ReportDocument)Cache["MyKey"]== null)
{
rep_doc.Load(sReportPath);
rep_doc.Refresh();
SetTargetParameterFields(ref rep_doc);
SetDatabaseLogon(ref rep_doc);
target_doc = rep_doc;
Cache.Insert("MyKey", target_doc, null,
DateTime.Now.AddMinutes(3), TimeSpan.Zero);
}
else
{
rep_doc = (ReportDocument)Cache["MyKey"];
}
___________________________________________________________
protected void Page_UnLoad(object sender, EventArgs e)
{
rep_doc.Close(); //this removes the cached report too!!!!
rep_doc.Dispose();
rep_doc = null;
}