1203389 - Err Msg: "Rereading the Database" when using report viewer navigation buttons in Asp.net Web Application

SAP Knowledge Base Articles - public

1203389 - Err Msg: "Rereading the Database" when using report viewer navigation buttons in Asp.net Web Application


When attempting to use the navigation button in the Crystal Report Viewer in a Visual Studio .NET Web application the following error message appears:

"Rereading the Database"


This error message appears because the report should be loaded in the page init () instead of page load() and we need to load the report in next web forms using Session object.



To resolve this error message, perform the following code:


Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class WebForm1

    Inherits System.Web.UI.Page
    Dim report As New ReportDocument
    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As Table
    Dim crTableLogOnInfo As TableLogOnInfo
    Dim crConnectionInfo As ConnectionInfo
    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldDefinition As ParameterFieldDefinition
    Dim crParameterValues As ParameterValues
    Dim crParameterDiscreteValue As ParameterDiscreteValue
    Dim crExportOptions As ExportOptions
    Dim crDiskFileDestinationOptions As DiskFileDestinationOptions

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        report_logon("pubs", "sa", ".", "sa")
        param("ord", 2)

        crDiskFileDestinationOptions = New DiskFileDestinationOptions
        crDiskFileDestinationOptions.DiskFileName = "C:\exported.pdf"

        crExportOptions = report.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With


        CrystalReportViewer1.ReportSource = report

    End Sub

Public Sub report_logon(ByVal dbase As String, ByVal pwd As String, ByVal server As String, ByVal uid As String)
        crConnectionInfo = New ConnectionInfo
        With crConnectionInfo
            .DatabaseName = dbase
            .Password = pwd
            .ServerName = server
            .UserID = uid
        End With

        crDatabase = report.Database
        crTables = crDatabase.Tables

        For Each crTable In crTables
            crTableLogOnInfo = crTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    End Sub

   Public Sub param(ByVal paramname As String, ByVal paramvalue As Object)

        crParameterFieldDefinitions = report.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item(paramname)

        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterDiscreteValue = New ParameterDiscreteValue
        crParameterDiscreteValue.Value = paramvalue




        "Load the report on the next page using session object"


Initialize component ()

Session("crReportDocument")= new reportdocument

End sub


CrystalReportviewer1.reportsource= session ("crReportDocument")

This will resolve the issue.


rereading the database , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , How To


SAP Crystal Reports 10.0