Click here to Skip to main content
Rate this: bad
good
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 1:06am
Edited 18-Jul-12 1:08am
v2
Comments
MAU787 at 18-Jul-12 6:09am
   
hi..
how u r assigning data to your report??
ooffooooo at 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 at 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
0 OriginalGriff 190
1 Jochen Arndt 165
2 PIEBALDconsult 150
3 BillWoodruff 148
4 DamithSL 140
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 18 Jul 2012
Copyright © CodeProject, 1999-2014
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