SAP Knowledge Base Article - Public

2022806 - Crystal Reports .NET application throws "Object reference not set to an instance of an object" error when database logon fails.

Symptom

  • Crystal Reports .NET application throws "Object reference not set to an instance of an object"  error when database logon fails.
  • It is expected to see an error message relevant to database logon instead the APIs throw a generic error message.

Environment

  • Crystal Reports 2008 / SAP Crystal Reports Developer version for Microsoft Visual Studio.
  • SAP BusinessObjects Business Intelligence platform 4.1
  • Visual Studio 2008 / Visual Studio 2010

Reproducing the Issue

1. Develop a sample windows or a web application using below code.

ReportDocument rd = new ReportDocument();

rd.load("reportPath.rpt");

rd.setdatabaselogon("Username","Password","DBServer","DBname");

rd.ExportToDisk(ExportFormatType.PortableDocFormat, @"C:\Exported.pdf");

2. Enter incorrect logon info in SetDatabaseLogon method.
3. Run the application and observe the error.

Cause

The issue has been identified as a bug.

Resolution

  • This issue was tracked with problem id ADAPT01728691.
  • The issue is fixed in BOE 3.1 SP6 Patch 5 / SP7 Patch 2.
  • The issue is fixed in BI 4.1 SP5

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Bug Filed

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2005