[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Cannot Cache a crystal report, Urgent!!!

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;

}
1 Answer

Alvin Bruney [ASP.NET MVP]

8/26/2006 12:45:00 AM

0

you might find more specialized help for this in the crystal reports
newsgroup

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/b...
-------------------------------------------------------


"Debi" <debi@nospam.com> wrote in message
news:689E0E36-32F3-4C84-A179-A1A747F9067E@microsoft.com...
> 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;
>
> }