>>Crystal Report (Object Reference not set to an instance of an object.) RRS feed

  • Question

  • User-1924666908 posted


    This is my first time to use Crystal Report.

    I took help from following link:


    Code for Crystal Report Form View:

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="GPONSearchCrystalView.aspx.vb" Inherits="GPONSearchCrystalView" title="Untitled Page" %>
    <%@ Register Assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
        Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
        <CR:CrystalReportViewer ID="rptviewer" runat="server" AutoDataBind="True" DisplayGroupTree = "False" Height="1121px" ReportSourceID="CrystalReportSource1" Width="767px" />
        <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
            <Report FileName="CrystalReport.rpt">


    Imports CrystalDecisions.Shared
    Partial Class GPONSearchCrystalView
        Inherits System.Web.UI.Page
        Protected Sub rptviewer_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles rptviewer.PreRender
            ' attached our report to viewer and set database login. 
            Dim report As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
            report.SetDatabaseLogon("username", "pwd", "server", "database")
            rptviewer.ReportSource = report
        End Sub
    End Class



    1. It is prompting for password. Ok when I remove this from "CrystalViewerReport Task" then it is showing me error, otherwise it is working fine.

    2. When it is working fine but columns are overlaping each other.

    3. I used above code in PreRender event because as suggested in the weblink I couldn't find OnPreRender event. what will be the difference?

    4. May I use crystalviewer by providing search parameters on real tim basis?

    Any swift idea would be helpful.


    Monday, November 1, 2010 6:20 AM

All replies

  • User-1924666908 posted

    no reply...

    Monday, November 1, 2010 10:27 AM
  • User-1924666908 posted

    still waiting for reply. 

    Tuesday, November 2, 2010 12:46 AM
  • User-1924666908 posted

    Please reply...............Surprised

    Tuesday, November 2, 2010 12:59 PM