Problem with my crystal reports once they have been deployed.

mike55

Well-known member
Joined
Mar 26, 2004
Messages
726
Location
Ireland
Hi all,

Have a number of crystal reports that are pulling information from the database and displaying that data in the correct fashion. I am also displaying these reports in .pdf format.
Code:
Private Sub generateReport()
        Dim oRpt As New rptMembers
        oRpt.DataDefinition.FormulaFields("Org").Text = "" + Session("OrgID") + ""
        oRpt.DataDefinition.FormulaFields("GID").Text = "" + Request.QueryString("GID") + ""
        oRpt.DataDefinition.FormulaFields("Active").Text = "" + Request.QueryString("Active") + ""
        oRpt.DataDefinition.FormulaFields("User").Text = "" + Request.QueryString("by").Replace("", "`") + ""

        Try The following try catch statement is responsible for generating the report in a .pdf format.
            Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
            crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
            crLogonInfo.ConnectionInfo.ServerName = "localhost"
            crLogonInfo.ConnectionInfo.UserID = dsGlobal.readReg("Software", "SureTxt", "User")
            crLogonInfo.ConnectionInfo.Password = dsGlobal.readReg("Software", "SureTxt", "Pass")
            oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)

            Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
            Dim myDiskFilesDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
            Dim myExportFile As String

            myExportFile = "C:\temp\PDF " & Session.SessionID.ToString & ".pdf"
            myDiskFilesDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
            myDiskFilesDestinationOptions.DiskFileName = myExportFile
            myExportOptions = oRpt.ExportOptions

            With myExportOptions
                .DestinationOptions = myDiskFilesDestinationOptions
                .ExportDestinationType = .ExportDestinationType.DiskFile
                .ExportFormatType = .ExportFormatType.PortableDocFormat
            End With

            oRpt.Export()

            Response.ClearContent()
            Response.ClearHeaders()
            Response.ContentType = "application/pdf"
            Response.WriteFile(myExportFile)
            Response.Flush()
            Response.Close()

            System.IO.File.Delete(myExportFile)
        Catch
        End Try
    End Sub

The problem that I am experiencing is that once I deploy my web application upto the web server, the crystal reports cant be displayed. The same problem exists if I try and view the crystal reports on my machine through the web browser of another machine.

Any suggestions on what the problem could be?

Mike55.
 
Back
Top