Link to home
Start Free TrialLog in
Avatar of aletheia1
aletheia1

asked on

Change datasource

Hi,
I have a BIG doubt about Crystal Report.

I've created a report connecting to a "test" database.
Now I want to use this report for test and for production, too (2 different DB).

But, when I access from my ASP page, it gives me the error: "the table xxxxxx cannot be found".
But the tables exist, because I can perform query in my ASP application correctly!

What can I do to change the datasource?
Even if I do like this (from ASP) it doesn't work:

If Request.Cookies("connection")("db") = "prod" Then
     CryTable.SetLogOnInfo "dbProd",,"user","password"
ElseIf Request.Cookies("connection")("db") = "test" Then
     CryTable.SetLogOnInfo "dbTest",,"user","password"
End If

It works ONLY with test.
Also if I access within Crystal Report to DB production (I save the report without saving data), it gives me the same error.

I really need help!
Every suggestions will be appreciated.
Thanks
Avatar of leonbutler
leonbutler

Have you changed the actual datasource of your Crystal Report?

To do so;

1. Choose Database from main menu
2. Then Set Location
3. Select a table from your report
4. Click "Set Location"
5. The "Data Explorer" window opens
6. Choose another datasource and then click "Set"

Your report should now run from your Production DataSource.

Leon
Avatar of aletheia1

ASKER

Yes, if I do like this it works... but now ONLY for production datasource!

I mean, from the ASP application the user can choose to work in test OR in production.
If he choose test, the report should connect to test DB.
If he choose production, the report should connect to production DB.

In other words, the report should be "indipendent" from the data source. I don't have to enter in Crystal Report and change it manually everytime.

Is it possible?
Thank you
you also need to change the table location. this shows the relevant code
http://support.businessobjects.com/library/kbase/articles/c2001075.asp
I saw the example,
it says to use this code to change the table owner:

crpTable.Location = production.owner2.tablename

but if I have more than 1 table, how can I do?
Thanks
ASKER CERTIFIED SOLUTION
Avatar of EwaldL
EwaldL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh, thank you.
I'll try it.