It’s a known fact, that in Crystal Reports, if you try to display details, using data in a SQL Server Database other than the one that you’ve used to design the report, either you have to set the database location (or refresh the report). This is a common issue that development team face when the reports are being deployed to the production environment.
But this can be prevented using the following method.
Following namespaces are required.
And we have to assign the required SQL server information to each table/view of the report, sub reports and the report viewer.
Use the following code: