Click here to Skip to main content
15,868,027 members
Articles / Web Development / ASP.NET

Problem of Crystal Reports When Not Closing Report Document Object

Rate me:
Please Sign up or sign in to vote.
1.88/5 (7 votes)
5 Aug 2007CPOL1 min read 29K   7   1
This article is about Issue in Crystal report

Introduction

This article is about the space allocation problem that is caused by running Crystal reports in ASP.NET. It is about the files created in temp folder of system.

Background

I stuck with the problem of space in Windows temp folder for quite sometime when I was running Crystal reports in my ASP.NET application. Whenever I run a Crystal report, some files are loaded into my server temp (c:\windows\temp) folder. When that folder reaches a certain capacity, "Load Report Failed" error occurs. When I try to delete these files manually from temp folder, it gives an error notice:

"File cannot be deleted. It is being used by another person or program…." 

Using the Code

Whenever I run a Crystal report in my ASP.NET application, Crystal report file and some other files are created in temp folder. When that folder reaches a certain capacity, it gives "Load Report Failed" error.

When I try to delete those files manually from temp folder, they cannot be deleted and throw an error message:

"File cannot be deleted. It is being used by some other person or program.............." 

The only way to delete those files is to reboot the system and delete the files manually which is of course not the desired solution.

Finally, to resolve this problem, I have added the following line of code into the finally statement of the try catch block. This will automatically delete the files from temp folder.

// try {Use the report object and do load report etc.......} catch()
// {Handles exception here......} finally{NewReport.Close();} 

History

  • 6th August, 2007: Initial post

License

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


Written By
Software Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThis is not a problem with Crystal Reports... Pin
BrianE6-Aug-07 9:59
BrianE6-Aug-07 9:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.