Wrox Programmer Forums
|
BOOK: Professional Crystal Reports for VS.NET
This is the forum to discuss the Wrox book Professional Crystal Reports for Visual Studio .NET by David McAmis; ISBN: 9780764544033
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Crystal Reports for VS.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2004, 04:13 PM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 PDF Export SQL login problem

I am trying to export the report to a PDF and then use the Acrobat Viewer as described in Chapter 4. But I am having problems setting my report to Login to my SQL Server and so that I can pass Selection Formula to the report. I only seem to be able to get the routine described to work for saved data within the report.
 
Old May 25th, 2004, 11:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=6389
HTH.

Always:),
Hovik Melkomian.
 
Old May 26th, 2004, 07:52 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply. But, I can get that part to work when using the crystal reports web viewer and I can login to the database and pass the parameter as expected. The problem is with the next section when I try to create the form with a button that exports the report to Acrobat Reader so it can be printed.

Below is the code I am using that is causing the Login Failed. I have verified the SQL login and it is correct.

Private Sub PDF_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PDF_Button.Click
        Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
        Dim myDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions

        Dim myExportFile As String
        Dim myReport As New PatDetail

        myExportFile = "C:\RPT_TEMP\PDF " & Session.SessionID.ToString & ".pdf"

        myDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
        myDiskFileDestinationOptions.DiskFileName = myExportFile
        myExportOptions = myReport.ExportOptions
        With myExportOptions
            .DestinationOptions = myDiskFileDestinationOptions
            .ExportDestinationType = .ExportDestinationType.DiskFile
            .ExportFormatType = .ExportFormatType.PortableDocFormat
        End With


        myReport.Export()

        myReport.RecordSelectionFormula = "{Vw_PatLog.PatAccount} = 'XXXXXXXXXXXX'"
        myReport.Refresh()

        Dim myDBConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

        With myDBConnectionInfo
            .ServerName = "SERVER"
            .DatabaseName = "DATABASE"
            .UserID = "USER"
            .Password = "PASSWORD"
        End With

        Dim myTableLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo

        Dim myDatabase = myReport.Database
        Dim myTables = myDatabase.Tables
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

        For Each myTable In myTables
            myTableLogonInfo = myTable.LogOnInfo
            myTableLogonInfo.ConnectionInfo = myDBConnectionInfo
            myTable.ApplyLogOnInfo(myTableLogonInfo)
        Next

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

        System.IO.File.Delete(myExportFile)


    End Sub
 
Old May 26th, 2004, 09:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Well sorry but I havent worked on Export & Acrobat myself.

Always:),
Hovik Melkomian.
 
Old January 18th, 2005, 12:02 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you find a solution to this problem. I am trying to figure out the very same thing.

dfw

D. Franklyn





Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to PDF problem with crystal report in c# fidelio ASP.NET 1.0 and 1.1 Professional 0 April 12th, 2006 07:34 AM
facing problem to export crystal report to PDF whi agarwal Beginning VB 6 0 November 12th, 2005 06:57 AM
Probelm : Export to PDF problem upermadi Crystal Reports 0 December 22nd, 2004 11:44 PM
Crystal Report 8.5 Export to PDF problem DragonSon Crystal Reports 0 August 17th, 2004 10:32 PM
Crystal 9 PDF export problem AlexB Crystal Reports 0 January 7th, 2004 04:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.