Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Report with the ability to dynamically change database name.

Posted on 2009-05-08
3
Medium Priority
?
574 Views
Last Modified: 2012-05-06
I work in an environment (like everyone else) that consists of a production database and a test database.  My test environment is an exact image of my production database.  What I'd like to do is to create a Crystal Report that works for both environments...if this is possible.  Basically, I'd like for my users to be able to run reports in our testing environment without having to re-create all of my Crystals to point towards the test database.  Having two sets of each Crystal isn't something that I'd like to do...or maintain.

Basically I'd like to just change the database name dynamically at runtime.

Thanks in advance,
Corey
0
Comment
Question by:C Williams
  • 2
3 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 24338711
You can use the same report.

There are 3 ways to do this.
Use the SET DATABASE LOCATION to alternate as required

Use an application to run the reports and change the database through code.

If the test and prod are physically separate networks you could set the TEST network up to look exactly like the PROD network including server names.  In that way the report doesn't know anything has changed.  That is what we di and never had a problem moving reports from one to the other.

mlmcc
0
 

Author Comment

by:C Williams
ID: 24338835
Sorry for my ignorance but you say "SET DATABASE LOCATION", how/where would I use this code?  Because if this is code that I could use within the actual Crystal, I think that'll be the way I'd like to go.

Corey
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 total points
ID: 24340199
This assumes it is a full version of Crystal not a VS version.
Open the report in Crystal
Click DATABASE --> SET DATABASE LOCATION
The steps from here are version dependent.  I don't have CR9 so I am not sure how they do it.
CR XI has 2 windows on the popup.
Top one is the report database location
Bottom one allows you to navigate to a new database

mlmcc
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question