?
Solved

Crystal Report exported as PDF not found

Posted on 2013-12-02
3
Medium Priority
?
580 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 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