Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i create CrystalReportSource and tried this code

C#
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
Updated 18-Jul-12 0:08am
v2
Comments
MAU787 18-Jul-12 6:09am    
hi..
how u r assigning data to your report??
Mohammed Abdul Muqeet 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

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900