C# – Crystal Reports datasource in Visual Studio

ccrystal-reportsvisual studio

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?

Best Answer

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.