Click here to Skip to main content
15,887,323 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
protected void Page_Load(object sender, EventArgs e)
{
//Give name of the report which you have created
string exportFileName = "reportMission.rpt";
string exportPath = "C:/Users/Gilbert/Desktop/reportMission.pdf"; //where file will be exported
ReportDocument crReportDocument = new ReportDocument();

crReportDocument.Load("C:/Users/Gilbert/Desktop/Apps_Minisante/Apps_Minisante/reportMission.rpt");
//Export the report to disk.
crReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, exportPath);
}
Posted

1 solution

I have had this problems several times in the past.My solution is dependant on what version of the control you are using.
If you are using version for versions of visual studio greater than 2010, the default behavior when loading the Crystal Control is to throw an exception if you have that same file open in Crystal Reports XI or Crystal Reports II somewhere on your network. If you have that report open, close it and try reloading the control and see what happens.
 
Share this answer
 
Comments
Gilbertinino 27-Feb-13 8:35am    
Am using visual studio 2008 not 2010.
Gerenatian 27-Feb-13 8:48am    
You might be loading with an invalid report path. Yours looks backwards after taking a second look at the code. Try: (@"C:\Users\Gilbert\Desktop\Apps_Minisante\Apps_Minisante\reportMission.rpt");
Remember that \ is an escape char and to use the @ symbol to turn them off. Make sure you are pointing to a good pat.

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