0
votes

I'm using crystal reports 9, visual studio 2008, and oracle 9i in this project I'm doing. My crystal reports pull data from an oracle database, and are displayed on a CrystalReportViewer on a windows form. How would I make this connection using vb.net code?

Imagine this little scenario:

The host name for the oracle server is myHost. The database name is myData The username is myUser The password is myPass.

Please assist me with the code to make this connection.

Your help will be highly appreciated.

1

1 Answers

0
votes

Basically, you have a few options. If you've created a connection inside of the Crystal Report then you can hand off different login credentials to the report and crystal will handle it. You have to do it in a specific way through or it won't work (it's very picky on the order in which it's done). You will loop through the report and all the sub reports handing off new crendentials. The second route is to use a DataTable as your DataSource, populate it via VB.Net and hand it off (this doesn't sound like the route you're wanting to go).

Here are two blog entries where I describe how to pass new login credentials off to Crystal.

https://www.blakepell.com/2010-09-17-crystal-reports-changing-the-database-connection-from-net-subreport-links-and-the-case-of-the-missing-parameter-values

https://www.blakepell.com/2012-05-22-crystal-reports-extension-methods

In the first blog entry there is a "Private Sub ApplyNewServer(ByVal report As ReportDocument)" that will show you how to pass your new login and server information. It was extracted from another class so it might need slight modification to reference the login parameters you want to pass in.

Best of luck. ;)