The Acumen software design blog provides you with helpful articles about Crystal Report.

Several web sites provide a good overview.

Official Crystal Reports Overview

Crystal Reports Wikipedia

Crystal Report

Crystal Report

Object reference not set to an instance of an object.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, “Registration Reports”)

This occurs because the Login credentials provided are not valid.  In particular, you cannot change SERVER or DATABASE with

SetDatabaseLogon(User, Password, Server, Database)

See:   http://msdn.microsoft.com/en-us/library/ms227750(v=vs.80).aspx

Code:

              First:        Dim Server As String = ConfigurationManager.AppSettings(“DBServer”)

              Second:    Dim Database As String = ConfigurationManager.AppSettings(“Database”)

              Third:       Dim User As String = ConfigurationManager.AppSettings(“DBUser”)

              Last:         Dim Password As String = ConfigurationManager.AppSettings(“DBPassword”)

 

                ‘ The following set of code is necessary to dynamically change the SERVER and DATABASE.

                Dim ci As CrystalDecisions.Shared.ConnectionInfo = New ConnectionInfo()

                ci.Type = ConnectionInfoType.CRQE

                ci.ServerName = Server

                ci.DatabaseName = Database

                ci.UserID = User

                ci.Password = Password

                Dim tli As TableLogOnInfo = New TableLogOnInfo()

                tli.ConnectionInfo = ci

                Dim t As CrystalDecisions.CrystalReports.Engine.Table

                For Each t In CrystalReportSource1.ReportDocument.Database.Tables

                    t.ApplyLogOnInfo(tli)

                Next t

                CrystalReportSource1.ReportDocument.SetParameterValue(“@var1”, Request.QueryString(“param1”))

                ‘ The following will fail if the login fails:

                ‘        “Object reference not set to an instance of an object”

                ‘        “Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.”

                CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, “Registration Reports”)

 

For more information how Acumen can help with your software needs, contact us today!