Hi all,
i am facing a problem regarding crystal reports.i am working on a software which contains a large number of crystal reports.A user might open a large number of reports having different information.Whe n i view in Activity monitor of SQLSERVER2005,m y software has a session with db server(its ok,as i have made it run seperate) and each report has its own session(its ok aswell).The problem which i face is even after closing report the session still exists in Database.Just imagine the overhead when 200 users connects to this software,openin g different reports.I wrote a code to dispose this report but this doesnot work effectively.I am using visual studio2005 with C# .Here is the code which is called for every report but it shows effect on the closing of all reports(all the sessions are closed when last report is closed,not before that).
private void ReportViewer_Fo rmClosing(objec t sender, FormClosingEven tArgs e)
{
// REason :To reduce overload on SQL server
CrystalDecision s.CrystalReport s.Engine.Report Document reportObj = (CrystalDecisio ns.CrystalRepor ts.Engine.Repor tDocument)crVie wer.ReportSourc e;
reportObj.DataS ourceConnection s.Clear();
reportObj.Dispo se();
crViewer.LogOnI nfo = null;
crViewer.Report Source = null;
crViewer.Dispos e();
GC.Collect();
GC.WaitForPendi ngFinalizers();
}
Please take me out of this dilema.Thanks in advance.Waiting for ur kind and quick response.
i am facing a problem regarding crystal reports.i am working on a software which contains a large number of crystal reports.A user might open a large number of reports having different information.Whe n i view in Activity monitor of SQLSERVER2005,m y software has a session with db server(its ok,as i have made it run seperate) and each report has its own session(its ok aswell).The problem which i face is even after closing report the session still exists in Database.Just imagine the overhead when 200 users connects to this software,openin g different reports.I wrote a code to dispose this report but this doesnot work effectively.I am using visual studio2005 with C# .Here is the code which is called for every report but it shows effect on the closing of all reports(all the sessions are closed when last report is closed,not before that).
private void ReportViewer_Fo rmClosing(objec t sender, FormClosingEven tArgs e)
{
// REason :To reduce overload on SQL server
CrystalDecision s.CrystalReport s.Engine.Report Document reportObj = (CrystalDecisio ns.CrystalRepor ts.Engine.Repor tDocument)crVie wer.ReportSourc e;
reportObj.DataS ourceConnection s.Clear();
reportObj.Dispo se();
crViewer.LogOnI nfo = null;
crViewer.Report Source = null;
crViewer.Dispos e();
GC.Collect();
GC.WaitForPendi ngFinalizers();
}
Please take me out of this dilema.Thanks in advance.Waiting for ur kind and quick response.