We help IT Professionals succeed at work.
Get Started

Crystal report from asp.net works then randomly stops

Last Modified: 2012-05-11

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

        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.Location = Helpers.GetConfigSetting("DefaultDatabaseName") & ".dbo." & myTable.Location
        CrystalReportViewer1.ReportSource = Report

Open in new window

Watch Question
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE