borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Repository Only For Enterprise Installation?)Next Topic (Crystal report in VB.Net Standard?) New Topic New Poll Post Reply
AndreaVB Forum : Reporting tools : VB6 and Crystal Reports 7
Poster Message
lynxabe
Level: Protégé

Registered: 04-02-2005
Posts: 5

icon VB6 and Crystal Reports 7

I want to take an existing CR7 report (.rpt file) and incorporate it into my VB application.   I am totally lost as to what I need to do.  

My environment:
OS:  Windows 98 or 2K
Database = Oracle8
Crystal Reports (CR) Version 7
Visual Basic 6

I basically want the user to have the ability to run this Crystal report when pressing a command button from my VB app.  I would like the report to display on a viewer with the option to print the report.

This CR report connects to an Oracle8 database.  The report runs fine outside of VB6.  I have to supply the username/password and database name.

This CR report was developed in CR7 Developer (outside of any VB designer).

How do I make it so that credentials are passed to the report within VB?  Do I need to set up ODBC for this?  Which driver would I use?  When running CR7 stand alone, we use the Oracle native driver... we do not use ODBC.

Are there any good resources describing the ins and outs of using Crystal in VB6 with an Oracle database?

This is what I tried...
I have ODBC set up for the Oracle8 database using an Oracle driver.  
Connection has successful.  
I added Crystal Report Control component on my form.
In command1_click the code is...

form1.crystalreport1.destination = crptToPrinter
form1.crystalreport1.reportfilename = "c:\rpt\myreport.rpt"
form1.crystalreport1.action = 1

I get a cannot open sql server (runtime error 20599).  Which I am assuming, it cannot log into the report to run it.  Debugger shows me that the line of code where it errored is
form1.crystalreport1.action = 1

Thanks in advance,
LX

09-02-2005 at 07:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: VB6 and Crystal Reports 7

It is not a matter of Vb code, it is a matter of CR cant establish a conenction to oracle database. Most probably your connection string to oracle database is wrong. Can you make a preview in CR designer?

____________________________
If you find the answer helpful, please mark this topic as solved.

09-02-2005 at 09:23 PM
View Profile Send Email to User Show All Posts | Quote Reply
lynxabe
Level: Protégé

Registered: 04-02-2005
Posts: 5
icon Re: VB6 and Crystal Reports 7

Yes, I can run the CR report and obtain data back successfully.  I feel the database connection is sound, however when I run the CR report from designer I need to supply the username/password and databasename.

How does that get resolved when using VB, since I am not supplying that information.  I do not receive any logon box to supply the information.

If I use ODBC, when I set up the ODBC connection, there is no place to enter the password.

Thanks,
LX

09-02-2005 at 10:00 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: VB6 and Crystal Reports 7

I never used CR7, so I dont know what interface does it have, but you can try this:

CR.LogOnToServer (pDllName as string,pServerName as String,[pDatabaseName],[pUserID],[pPassword])

This is a syntax for LogOnToServer method where

pdllName=pdsodbc.dll

____________________________
If you find the answer helpful, please mark this topic as solved.

10-02-2005 at 12:33 AM
View Profile Send Email to User Show All Posts | Quote Reply
lynxabe
Level: Protégé

Registered: 04-02-2005
Posts: 5
icon Re: VB6 and Crystal Reports 7

Thanks Goran,
I will give that a try.  If I am understanding you correctly I would enter something like this in my command1_click VB code...

form1.crystalreport1.LogOnToServer ("pdsodbc.dll",pServerName as String,[pDatabaseName],[pUserID],[pPassword])
form1.crystalreport1.destination = crptToPrinter
form1.crystalreport1.reportfilename = "c:\rpt\myreport.rpt"
form1.crystalreport1.action = 1

I am very familiar with Crystal Reports.  The driver name does look like the one I am using.  My experience level with VB is fairly new, so my confidence is still low.

Please let me know if this correct.  I will test it out first thing in the AM.

Thanks again,
LX

10-02-2005 at 12:50 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: VB6 and Crystal Reports 7

Yes. something like that, altough you should put ReportFileName on first place, or it will be unable to logon. And you should, of course change servername, databasename, user and password to ones that matches your request.

____________________________
If you find the answer helpful, please mark this topic as solved.

10-02-2005 at 12:04 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Reporting tools : VB6 and Crystal Reports 7
Previous Topic (Repository Only For Enterprise Installation?)Next Topic (Crystal report in VB.Net Standard?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder