Solved

Crystal Report exported as PDF not found

Posted on 2013-12-02
3
576 Views
Last Modified: 2013-12-08
I have an ASP.NET application which stores data in SQL Server 2000.  I'm in the process of migrating the data to SQL Server 2008 R2.  I created a test version of the application which is exactly the same as the production version except it uses SQL Server 2008 R2 which contains a copy of the data.  Everything works fine except the reports no longer open.  The reports were developed with Crystal Reports XI.  The reports open in the test version on my development machine but not from the test site on the production server.
I believe the problem is because the application in on one server and SQL Server 2008 R2 is on another.  If I point one of the reports back to SQL Server 2000 it will then open.

Both  the production and the test application should save the exported PDF file to the same folder.  The test app will create a file in that folder using :
File.Create("C:\WebApps\ClientTrack\Reports\TestFile.txt")

The app has a function which excepts a Crystal Report as a parameter and should export a PDF file.  Below is my  code.

    Public Function MakePDFfile(ByVal crpt As Object) As String
        Dim TodayFile As String
        Dim dfdo As New CrystalDecisions.Shared.DiskFileDestinationOptions()
        Dim FileName As String

        'Check to see if the C:\WebReports folder has been purged today.
        'If it hasn't delete everything in it and created a file named after
        'today's date to indicate that it has been purged today.
        TodayFile = Month(Now) & Day(Now) & Year(Now)
        'If the file doesn't exist, kill everything and re-create it.
        If Not File.Exists("C:\WebApps\ClientTrack\Reports\" & TodayFile) Then
            Try
                'deletes all files in the folder due to *.*
                Kill("C:\WebApps\ClientTrack\Reports\*.*")
            Catch ex As System.IO.FileNotFoundException
                'If no files exist in the folder just keep going.
            End Try
            File.Create("C:\WebApps\ClientTrack\Reports\" & TodayFile)
        End If
        'Create a PDF file from the Crystal Report that was passed to this function.
        FileName = DateAndTime.Timer & Session("UserName") & ".pdf"
        dfdo.DiskFileName = "C:\WebApps\ClientTrack\Reports\" & FileName
        Try
            With crpt
                .ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
                .ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
                .ExportOptions.DestinationOptions = dfdo
                HttpContext.Current.Response.Write(.ExportOptions.DestinationOptions.DiskFileName & "<br/>")
                .Export()
                .Close()
                .Dispose()
            End With
            GC.Collect()
            GC.WaitForPendingFinalizers()
            MakePDFfile = FileName
        Catch ex As Exception
            Dim errors As String = ex.StackTrace

            Try
                If CType(crpt, ClientTrack.FinancialTransactions).ResourceName() = "FinancialTransactions.rpt" Then
                    Me.Context.Items("Financial Transactions Error") = True
                Else
                    ErrorHandler(ex)
                End If
            Catch exp As Exception
                ErrorHandler(ex)
            End Try
        End Try
    End Function

Any suggestions would be greatly appreciated.
0
Comment
Question by:leskelly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 39690885
Did you change the report to use the new database?
DO they run in the designer?

mlmcc
0
 

Accepted Solution

by:
leskelly earned 0 total points
ID: 39693296
I found a web page with the solution to my problem.  

http://msdn.microsoft.com/en-us/library/ff647402.aspx#paght000015_sqlserver

If anyone else is having this problem go to the link above.  At the top of the page is a Contents area.  Click on SQL Server and it will take you to the relevant section.
0
 

Author Closing Comment

by:leskelly
ID: 39704080
I found my own solution.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question