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 November 19th, 2009, 11:03 AM
Registered User
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help from the start (vb)

Good Morning,

I have been trying a few different ways to get the job done, but it never works.

mission: i need to run a cr .rpt, offer parameter values, and then export a pdf to a file.

here is what is have already, but this is giving me errors abound.

if someone could steer me in the right direction, that would be great!!

there is urgency to this project! but then again, isn't every project?

i have the luxury of using vb express, so i cannot simply add a CR into my project.

Public crConn As ADODB.Connection
Public crRS As ADODB.Recordset
Public crApp As CRAXDDRT.Application
Public crRpt As CRAXDDRT.Report
Public crSQL As String
Public crDBTable As CRAXDDRT.DatabaseTable


Test.crViewer.DisplayBorder = False
Test.crViewer.DisplayTabs = False
Test.crViewer.EnableDrillDown = True
Test.crViewer.EnableRefreshButton = True

crConn = New ADODB.Connection
crConn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
crConn.ConnectionString = "DSN="MyDSN";UID="username";Pwd=;"
conn.Open() ~~errors here cannot connect to DSN

rs = New ADODB.Recordset

crSQL = "SELECT STATEMENT W/ PARAMETERS"

rs.Open(crSQL, crConn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
crApp = New CRAXDDRT.Application
crRpt = crApp.OpenReport("C:\Crystal\report.rpt")


crRpt.DiscardSavedData()
crRpt.Database.SetDataSource(crRS)
Test.crViewer.ReportSource = crRpt
Test.crViewer.ViewReport()

crRpt.ExportOptions.DiskFileName = "C:\Crystal\Output.pdf"
crRpt.ExportOptions.DestinationType = CRExportDestinationType.crEDTDiskFile
crRpt.ExportOptions.FormatType = CRExportFormatType.crEFTPortableDocFormat
crRpt.Export(False)

crRS.Close()
crRS = Nothing

crConn.Close()
crConn = Nothing
crApp = Nothing
crRpt = Nothing
 
Old November 21st, 2009, 05:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> conn.Open() ~~errors here cannot connect to DSN

In that case, you need to check your DNS. How is it configured? What database is it pointing to? Does it have the right user name and passwrod? What errors do you get excacly

You may also want to try different connection strings from www.connectionstrings.com

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Don't know where to start......... Geneine Bugg BOOK: Beginning ASP 3.0 0 December 20th, 2006 12:00 PM
Start Programming in VB.NET reality_42000 VB.NET 2002/2003 Basics 2 October 18th, 2006 05:40 AM
start.com david_ste BOOK: Professional Ajax ISBN: 978-0-471-77778-6 3 March 27th, 2006 06:22 AM
VB to start connection btpoole VBScript 2 November 1st, 2004 10:22 AM
Cant start the debugger vb.net local or remote? humour General .NET 0 September 6th, 2004 09:34 AM





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