Results 1 to 4 of 4

Thread: [Resolved] Trying to save Crystal report to file cause error

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    [Resolved] Trying to save Crystal report to file cause error

    Hi, I'm trying to save my open Crystal report to a file so I can then load the file and export it to PDF. Here is my code to save the file.
    VB Code:
    1. crpt = New RMSCompareRpt()
    2.         For Each myTable In crpt.Database.Tables
    3.             myLogin = myTable.LogOnInfo
    4.             With myLogin.ConnectionInfo
    5.                 .ServerName = "user"
    6.                 .UserID = "pass"
    7.                 .Password = ""
    8.                 .DatabaseName = "Miscellaneous"
    9.             End With
    10.             myTable.ApplyLogOnInfo(myLogin)
    11.         Next
    12.         crpt.RecordSelectionFormula = "{Compare.EmpID} = " & Request.Cookies("EmpID").Value
    13.  
    14.         CrystalReportViewer1.ReportSource = crpt
    15.         CrystalReportViewer1.RefreshReport()
    16.         CrystalReportViewer1.DataBind()
    17.  
    18.         crpt.SaveAs("C:\Test.rpt", ReportFileFormat.VSNetFileFormat)
    This causes the following error.

    Invalid file name.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid file name.

    Source Error:


    Line 59: CrystalReportViewer1.DataBind()
    Line 60:
    Line 61: crpt.SaveAs("C:\Test.rpt", ReportFileFormat.VSNetFileFormat)
    Line 62:
    Line 63:

    Anyone have a workaround for this?

    Thanks
    Last edited by indydavid32; Dec 10th, 2003 at 08:42 AM.
    David Wilhelm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width