Overriding the Data Source Connection inside The Report Viewer

If you need to use a report that is connected to a data source with similar content and structure to the original data source, but has a different name or driver, you can override the data source settings in The Report Viewer (TRV). Here's how to do it:

  1. Make sure the appropriate database driver is installed on your system. TRV uses the Crystal Reports runtime and APIs to connect to a variety of databases, so the first step is to ensure that the appropriate database driver is installed on the system. The specific driver needed will depend on the database being used.
  2. If the report connects using ODBC, check the DSN (Data Source Name) referenced in the report. This reference will be hard-coded into the report and TRV will search for the corresponding database driver on your system.
  3. If TRV can't find the database driver, you may receive an error message such as "failed to load report," a vendor database error code, or a password prompt. This can also happen if the Windows user doesn't have permission to use the driver.
  4. If TRV does find the database driver, it will use it to connect to the database. However, it's important to ensure that the driver is properly configured and that the user referenced in the driver has access to the database. If TRV gives you a message that a specific table or field does not exist in the database, it may be because the table or field does not exist in the database referenced in the driver or the user doesn't have permission to view it.
  5. Some reports may connect to Excel spreadsheets or .xls files. If the spreadsheet is stored on a specific path on your computer and you give the report to another user, they may receive an error message because the spreadsheet won't be on their computer at the same path. To make the report more portable, you can use the ODBC driver to access the data source or save the data source on network attached storage and map the network drive for each user.
  6. In some cases, you may want users to have access to different data sources with the same report. You can either give out multiple reports with different data-source references or override the database reference in the report using TRV. Note that TRV's data-source reference override feature only works on reports that reference one data-source.