473,383 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

weird Crystal Reports exception

hi,
i am encountering a sporadic exception using crystal reports that is causing
me grief, I can't 'handle' it...
my code is loading a typed report, and loading a DataSet to it.
unfortunately crystal reports customer support is very poor and their 'case
management' tool refuses to function. i'm posting here in the hope that
someone may have seen it before and worked around it.

first of all, here is the exception:

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
PEOpenPrintJobWithInfoW(* ) +0
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.Load(String
reportName, OpenReportMethod openMethod, Int16 parentJob) +989
CrystalDecisions.CrystalReports.Engine.ReportClass .Load(String
reportName, OpenReportMethod openMethod, Int16 parentJob) +457
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.-() +98
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.get_DataDefinition()
+7
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.SetParameterValue(String
name, Object value) +70
DocuSee.Report.Page_Load(Object sender, EventArgs e) +1872
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

as you can see, it is an internal CR exception, not caused directly by my
own code.
i checked all the basics, it is a perfectly valid dataset being used. also,
i don't have problems with other crystal reports using this same loading
technique.

here is my code:
Reports.crProducerApplicationForm rpt = new
Reports.crProducerApplicationForm();
rpt.SetDataSource(ds);
ExportCrystalReportToPDF(rpt, "Producer_Application.pdf");

and here is the ExportCrystalReportToPDF function

/// <summary>
/// Convert the Report to PDF and write to the HTTP response
/// </summary>
/// <param name="rpt">The report object</param>
/// <param name="filename">Should include include .pdf</param>
public static void
ExportCrystalReportToPDF(CrystalDecisions.CrystalR eports.Engine.ReportClass
rpt, string filename)
{
MemoryStream stream =
(MemoryStream)rpt.ExportToStream(CrystalDecisions. Shared.ExportFormatType.PortableDocFormat);
byte[] bytes = new Byte[stream.Length];
stream.Read(bytes, 0, (int)stream.Length);
stream.Close();
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.Buffer= true;
response.ContentType = "application/pdf";
response.AddHeader("Content-Disposition", "inline;filename=\"" + filename
+ "\"");
response.BinaryWrite(bytes);
response.End();
}
i have tested it with several different versions of acrobat, and it seems to
be completely on the server side where the error is happening. occassionally
when it does work, i have noticed incorrect download progress in the IE
status bar (when Acrobat is embedded), e.g. "downloaded 1.1Gb of 2.0Gb",
when the PDF is only a few K big.

the report itself is very simple, just displays fields and an image. it is
also 'up to date'.

it's quite a problem, so if anyone has any help, i would be extremly
grateful!
thanks
tim
Aug 29 '06 #1
1 2283
Hello Tim,

I'm not familiar with crystal report, as for the exception ,it seems
related to the report loading process, also I found that the report is
exposed to PDF stream, is the problem only occurs when you export the
report to PDF stream?

Also, you can try other simple report to see whether you can isolate the
issue and find some common characteristics on those problem reports?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard Hallgren | last post by:
Hi, I have a project that uses Crystal Reports (VS .Net included) and the System.Data namespace. I've managed to deploy the project and to get Crystal Report working on my clients XP based...
2
by: Mythran | last post by:
In .Net, how can I go about and set a Crystal Reports namespace? Right now they use the Root Namespace (VB) from the project. How can I extend the namespace for a single report (which will be set...
0
by: stephan | last post by:
I know that this has been beaten to death but I can't seem to resolve my issues (I have 2 of them). I have created a class that exposes a public method which returns a datatable as a datasource...
1
by: Islam Elkhayat | last post by:
I have problems with crystal Report... i use SQL query to fill dataGrid, i use checkboxs to select the column to return and build my query.. I want to create a report with the data of the datagrid...
3
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to...
2
by: Diogo Alves - Software Developer | last post by:
Hi, I'm desesperate, for long 4 days that I am trying to deploy an application with crystal reports, and it fails... I checked the documentation and it says the merge modules necessary to...
2
by: Code Monkey | last post by:
I've just developed an Windows application that uses Crystal Reports (v10 ? - the version that ships with VS2005). Whilst the application works fine - reports can be viewed on the development...
2
by: matt | last post by:
hello, i have an .RPT file that i am using to load a report via the ASP.NET CrystalReportViewer control. i dont include my .RPTs as embedded resources...instead i load the absolute path of the...
1
by: appandairajc | last post by:
Hi Friends, I have a problem in Crystal Reports. I have a web application and it was published in machine. I am running that application through a virtual path. All the pages are...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.