Click here to Skip to main content
12,397,805 members (46,489 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# ASP.NET C#4.0 , +
i create CrystalReportSource and tried this code

protected void Page_Load(object sender, EventArgs e)
{ 
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("CrystalReport1.rpt"));
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
v2
Comments
MAU787 18-Jul-12 6:09am
   
hi..
how u r assigning data to your report??
ooffooooo 18-Jul-12 6:23am
   
by CrystalReportSource i referd this link

http://csharpdotnetfreak.blogspot.com/2009/07/creating-crystal-reports-in-aspnet.html#comment-form
Kschuler 18-Jul-12 10:38am
   
Which line of code does the error occur on?

1 solution

Rate this: bad
 
good
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.
  Permalink  

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 | Mobile
Web02 | 2.8.160721.1 | Last Updated 18 Jul 2012
Copyright © CodeProject, 1999-2016
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