Click here to Skip to main content
13,202,873 members (57,164 online)
Rate this:
Please Sign up or sign in to vote.
i create CrystalReportSource and tried this code

protected void Page_Load(object sender, EventArgs e)
ReportDocument crystalReport = new ReportDocument();
crystalReport.SetDatabaseLogon("sa", "1@@@@9", @"server", "database");
CrystalReportViewer1.ReportSource = crystalReport;

it work fine , but when i put filter parameter it is showing this message on crystal report page..

object reference not set to an instance of an object

how can i solve this issue???
Posted 18-Jul-12 0:06am
Updated 18-Jul-12 0:08am
MAU787 18-Jul-12 6:09am
how u r assigning data to your report??
ooffooooo 18-Jul-12 6:23am
by CrystalReportSource i referd this link
Kschuler 18-Jul-12 10:38am
Which line of code does the error occur on?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Object reference not set to an instance of an object

This error happens when you try to use a property or call a method of an object that is null. More details: here[^]

A simple use of Visual studio DEBUGGER can tell you the object because of which it is happening. Just look at the stack trace and put a debugger on that line. Check the objects of that line and see if any one is null and you are trying to use that objects property. Handle the same.

For now, based on "when i put filter parameter it is showing this message", your filter parameters are having no values and you are trying to apply them. Correct the logic/flow.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 18 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100