views:

1172

answers:

3

Using Visual Studio 2005 with default install of Crystal Reports.

When I create a report, Crystal asks for the database, and I give it my development db. In the app, I create a DataTable and pass it to the report, which is then handed to the CR Viewer. At runtime, neither the report object, nor the viewer need to see the db since I have already retrieved the table.

When the app is handed to the users, everything works fine. They cannot see the development db.

Once, in the production office, I created a report at the production site, and instead of creating the Crystal Report by specifying the development db, I gave it the production db. Back in my own office, running in VS, the report tries to connect to the development db, and fails. (It's not visible.)

So, it's not a problem that they can't see my development database, but it is a problem that I can't see the production database.

Questions are: Does this arise because running in VS is different from running the installed app? Why does the report try to connect to the DB anyway? How do I control it?

A: 

I think I'm following...

When you are looking at the .rpt in VS, right-click on Database Fields in the Field Explorer window and go to 'Set Datasource Location'. What does it show for your connection? Is it pointing to the Production db server? This setting will be stored in the .rpt file so this might explain your issue.

Andy May
A: 

Andy, that's true, but it's more the question than the answer. The report does not actually need to connect to the server (I've handed it a DataTable), So why does it sometimes try to connect, and sometimes not?

SeaDrive
I have never had it not follow the Datasource Location unless I modified it programmatically. Do you do anything in code in respect to the source of the .rpt file? Are you using the ReportDocument class?
Andy May
what do you mean you handed it the DataTable? You mean the data itself? You may be setting up the schema of your datasource, from your dev database (which should be = to production), but how about the data?
Ricardo Villamil
A: 

When you create the report you should be able to do report.SetDataSouce(DataSet) and pass it your dataset that contains the tables that the report uses.

Malfist