Advertisement

02.19.2008 at 08:44AM PST, ID: 23174855
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

How do I change the database connection information in Crystal Reports from the development database to production database at runtime?

Tags: Business Objects, Crystal Reports, 11, Developer version, Visual Basic 6
I am having trouble with changing the database connection information from my development database to the production database when my reports program is run.
Here's the setup:  I develop the reports in Crystal Reports using a development database on my laptop. I have a Visual Basic 6 program that shows that report to the end user. The problem is getting the database connection information changed so it works on the user's computer, not just on my development computer.

Here's what I currently do (code follows):

Dim m_objReport As New rptCalendar

m_objReport.Database.LogOnServer "P2SODBC.dll", "myDSN", "prodDB", "userID", "myPassword"
   
   Screen.MousePointer = vbHourglass
   CRViewer1.ReportSource = m_objReport
   CRViewer1.ViewReport
   Screen.MousePointer = vbDefault

rptCalendar is a report file imported into Visual basic as a crystal reports designer component.
It works fine on my development computer and it also works on the production computer as long as the connection information, including the name of the database and the password, are identical on the production and development computer.
Obviously this isn't always possible.  How can I change this to make it work even if the development and production databases have very different logins?

I've tried a lot of different things from the Crystal help website, but nothing seems to work consistently.
I get a lot of errors like 'Login failed' on the production machine unless I make the logins identical.

I've also tried it like this for external reports (not integrated into the executable):

Dim crxTable As CRAXDRT.DatabaseTable
Dim m_crxApp As CRAXDRT.Application
Dim m_crxReport As CRAXDRT.Report

Set m_crxApp = New CRAXDRT.Application
      ' log on to the server
      m_crxApp.LogOnServer "P2SODBC.dll", "myDSN", "prodDB", "userID", "myPassword"
      ' open report object
     
      Set m_crxReport = m_crxApp.OpenReport(strReportNameAndPath, 1)
      ' set each table to the correct DSN, DB, UID and PWD    
      For Each crxTable In m_crxReport.Database.Tables
         crxTable.SetLogOnInfo "myDSN", "prodDB", "userID", "myPassword"
      Next crxTable

This works sometimes, but not always.

I usually get Login Failed errors with various codes.

What's the way to make this work - programatically so developed reports open up using production database?

Note:  I mostly use SQL Server databases, but sometimes need to use Access.

Thanks,

Ron
Start your free trial to view this solution
Question Stats
Zone: Database
Question Asked By: weiroblpay
Solution Provided By: Zberteoc
Participating Experts: 2
Solution Grade: B
Views: 110
Translate:
Loading Advertisement...
02.19.2008 at 09:22AM PST, ID: 20930442

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 10:59AM PST, ID: 20931402

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 12:49PM PST, ID: 20932442

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.19.2008 at 06:21PM PST, ID: 20934485

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.20.2008 at 07:55AM PST, ID: 20938945

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.05.2008 at 09:30AM PST, ID: 21052393

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.05.2008 at 10:21PM PST, ID: 21057825

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.06.2008 at 04:55AM PST, ID: 21059636

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.10.2008 at 08:11PM PDT, ID: 21092755

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628