SAP Knowledge Base Article - Public

2298839 - ER - Setting Database Location to "Same as Report" fails to open the database file

Symptom

When setting the data source to Same As Report in CR Designer causes a failed to logon to server type error.

The SDK is looking for the data files in the C:\Users\%USER%\AppData\Local\Temp folder.

The Enhancement is to update/find a way so the database API's are looking for the report in the same location as the report is loaded from and not from the \temp folder.

Environment

  • Crystal Reports for Visual Studio
  • BI 4.x .NET SDK

Reproducing the Issue

The set the data source to be Same as Report in CR Designer do the following:

  1. In CR Designer click on Database menu option and then, Set Location and expand the connection properties.
  2. You will see for example D:\Atest\xtreme.mdb in the path
  3. Right click on property: Database Name: D:\Atest\xtreme.mdb and select Same as report.
  4. This will change the path to: Database Name: .\xtreme.mdb

Resolution

We have added a registry key to change the default behaviour called - DataFileSameAsReportPath

[HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports\DatabaseOptions]

"DataFileSameAsReportPath"=dword:00000001

  1. If the key does not exist, CR for VS will look for the db file in the same location of report. - Example C:\MyReports
  2. If the key value is 0, will look for the db file in Users %TEMP% folder.
  3. If the key value is 1, will look for the db file in the same location of report. ( Same as default behaviour now )

This update is in of SP 17 and above

Keywords

OpenReportByDefault, Same as Report, .net, CR for VS, sameasreport , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio