• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

Crystal Reports Export Fails

Dear Experts,
When I'm trying to export a Crystal report, it is failing with an Error Database Logon Failed.  Please find the code attached.

Please let me know if Im missing something..

Thanks
Siva
Dim strconn = "Data Source=MUNINSERT2;User ID=isqlprd;Password=sysinsert;Initial Catalog=insertsystem"
        Dim sqlconn As New SqlConnection(strconn)
        sqlconn.Open()
        Dim ds As New DataSet()
        Dim param As SqlParameter
        Dim cmdDisclaimer As New SqlCommand("WorkOrderDisclaimersMedlineXML", sqlconn)
        cmdDisclaimer.Connection = sqlconn
        cmdDisclaimer.CommandType = CommandType.StoredProcedure
        param = cmdDisclaimer.Parameters.Add(New SqlParameter("@WorkOrderID", System.Data.SqlDbType.VarChar, 10))
        param.Direction = System.Data.ParameterDirection.Input
        param.Value = "6665470"
        Dim daMedline As New SqlDataAdapter(cmdDisclaimer)
        daMedline.SelectCommand = cmdDisclaimer

        daMedline.Fill(dsMedlineDisclaimer, "dtMedlineDisclaimerDetails")
        'daMedline.Fill(ds)
        'Close connection
        sqlconn.Close()
        Try
            Dim CR As New ReportDocument

            CR.Load("C:\WindowsApplication2\WindowsApplication2\Insert8x11.rpt")
            CR.SetDatabaseLogon("isqlprd", "sysinsert", "MUNINSERT2", "insertsystem")
            CR.SetDataSource(dsMedlineDisclaimer.Tables(0))

            'CR.SetDataSource(ds)
            'Dim ExportOptions As New CrystalDecisions.Shared.ExportOptions()
            'Dim DiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
            'DiskFileDestinationOptions = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions()
            'ExportOptions.ExportFormatType = ExportFormatType.CrystalReport
            'ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
            'DiskFileDestinationOptions.DiskFileName = "\\muninsert2\EDrive\SPT\InsertSystem\PrintQueue\CrystalReport1.rpt"
            'ExportOptions.ExportDestinationOptions = DiskFileDestinationOptions
            'CR.Export(ExportOptions)

            CR.ExportToDisk(ExportFormatType.PortableDocFormat, "\\muninsert3\EDrive\SPT\InsertSystem\PrintQueue\Insert8x11.rpt")
            CrystalReportViewer1.ReportSource = CR
            CrystalReportViewer1.Show()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

Open in new window

0
sivaman
Asked:
sivaman
  • 3
  • 2
1 Solution
 
CodeCruiserCommented:
Are there any subreports?
0
 
sivamanAuthor Commented:
No, there are no subreports. The report which Im loading is a report which is migrated from CR 4.0 to CR 2008.
0
 
sivamanAuthor Commented:
Please find attached the screen shot of the Error message .  Crystal-Reports-Export-Error.docx
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mlmccCommented:
Do you have more than 1 table in the report?
If so sometimes you have to loop through the tables and apply the logon information

mlmcc
0
 
sivamanAuthor Commented:
I'm able to export the reports. The report data source wasnt pointing to the right source.

Thanks
Siva
0
 
mlmccCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now