Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports 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 September 14th, 2004, 03:38 PM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default login error - passing data set to crystal reports


I have a web application, I am trying to create a pdf via crystal reports.
this code gives me a login error on the export call, I suspect because I have to pass the user name and password to crystal reports.

THe data set is used, since I want to view/create to pdf only certain record(s) based on user criteria.

If I can't make this work, can I pass a parameter to the crystal report? can I get a code sample? Feel free to email me directly for additional questions.

thanks

 Dim doc As New ReportDocument()
        Dim rptfile As String = "UAF.rpt"

        Dim filename As String = Server.MapPath(rptfile)
        doc.Load(filename)

        Dim ds As New DataSet()
        ' retrieve specific disbursement ID
        Dim strconn As String = "Driver={Sybase System 11};PWD=test;UID=userid;DB=dbname;servername=DEV"

        Dim ncon As OdbcConnection = New OdbcConnection(strconn)

        Dim UafCom As OdbcDataAdapter = New OdbcDataAdapter("Select disbur_id FROM disburse where disbur_id =1234 ", ncon)
        UafCom.SelectCommand.CommandType = CommandType.Text
        ncon.Open()

        Dim cmdbuilder As OdbcCommandBuilder = New OdbcCommandBuilder(UafCom)
        UafCom.Fill(ds, "disburse")

        doc.SetDataSource(ds)

        Dim exportOpts As ExportOptions
        exportOpts = doc.ExportOptions
        exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
        exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
        exportOpts.DestinationOptions = New DiskFileDestinationOptions()
        ' Set the disk file options.
        Dim diskOpts As New DiskFileDestinationOptions()
        diskOpts = New DiskFileDestinationOptions()
        diskOpts.DiskFileName = Server.MapPath("fin.pdf")

doc.Export()






Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal report binding with large data set, error lankark Crystal Reports 0 April 3rd, 2008 09:16 AM
Crystal Reports 8 second login liam8611 Classic ASP Basics 0 July 23rd, 2007 08:32 AM
Newbie Crystal Reports Login redbull8vodka Crystal Reports 0 January 19th, 2007 07:25 AM
crystal reports .net designer login failed error dilshan Crystal Reports 3 September 23rd, 2004 01:38 PM





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