Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Error in CR.NET (Access Denied)

Status
Not open for further replies.

tonylmiller

Programmer
Apr 18, 2002
16
US
I am getting the following error when I try to export to a PDF file. As far as I know, no other application is using this report file. I am using Crystal Reports.NET. I am getting the error when I am in Visual Studio.NET and I try to build and browse the form.

Error in File c:\inetpub\ Access to report file denied. Another program may be using it.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Error in File c:\inetpub\ Access to report file denied. Another program may be using it.

Code:
Source Error: 


Line 42: 
Line 43: 			// Export the report.
Line 44: 			Report.Export();
Line 45: 		}
Line 46:

My export code looks like this:

Code:
ReportDocument Report = new ReportDocument();
Report.Load("c:\\inetpub\\[URL unfurl="true"]wwwroot\\webapplication1\\rptitems.rpt");[/URL]

// Declare variables and get the export options.
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

diskOpts.DiskFileName = "c:\\report.pdf";

ExportOptions exportOpts = new ExportOptions();
exportOpts = Report.ExportOptions;

// Set the export format.
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;

// Set the disk file options.
exportOpts.DestinationOptions = diskOpts;

// Export the report.
Report.Export();

Any help would be greatly appreciated.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top