troubleshooting Question

Crystal report from asp.net works then randomly stops

Avatar of Enhanced Support
Enhanced Support asked on
ASP.NETCrystal Reports
4 Comments1 Solution540 ViewsLast Modified:
Hi,

I have a problem with the crystal report viewer control when launched from an asp.net web page.

This will work absolutely fine for several days at a time on the production site, showing various reports correctly, but then they all just stop working, and present the user with a blank page when launched. Obviously the database and credentials, e.t.c do not change, the reports simply will not show until the server is restarted. I do not think it is a memory leak issue because the w3wp.exe service is not using an excessive amount of memory. I have also tried making a call to gc.collect to see if previous reports had been left in memory, but this made no difference. When it stops working, no connection is shown in SQL server activity monitor, so I don't think it's getting as far as a database query.

Developed in visual studio 2008, sql 2008 r2, crystal 2008.

My ASPX page is as per normal blank template with just this :-
<%@ Register Assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"   Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<CR:CrystalReportViewer PrintMode="ActiveX" HasCrystalLogo="False" ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />

Open in new window


vb.net code behind in page.load (note the helpers class just provides relevant credentials).
        Dim Report As ReportDocument
        Report = New ReportDocument
        Report.Load(Hosting.HostingEnvironment.MapPath("~/App_reports/report1.rpt"))

        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
        Dim myTables As Tables = Report.Database.Tables
        Dim myTableLogonInfo As New TableLogOnInfo

        With myConnectionInfo
            .ServerName = Helpers.GetConfigSetting("CrystalDSN")
            .DatabaseName = Helpers.GetConfigSetting("DefaultDatabaseName")
            .UserID = Helpers.GetConfigSetting("DatabaseUser")
            .Password = Helpers.GetConfigSetting("DatabasePassword")
            .Type = ConnectionInfoType.SQL
        End With
        For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
            myTableLogonInfo = myTable.LogOnInfo
            myTable.LogOnInfo.ConnectionInfo.AllowCustomConnection = True
            myTableLogonInfo.ConnectionInfo = myConnectionInfo
            myTable.ApplyLogOnInfo(myTableLogonInfo)
            myTable.Location = Helpers.GetConfigSetting("DefaultDatabaseName") & ".dbo." & myTable.Location
        Next
        CrystalReportViewer1.ReportSource = Report

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros