So looking at your code, it looks like youre passing the report to the Crystal Viewer as well. Is there a reason youre doing that? To prevent having you look through LOTS of code at this point, these are my basic steps to making this work for my project:
** Load the report
** Set the parameters and add the current values to the report document itself: (rptDoc.DataDefinition.ParameterFields("myParam").AddCurrentValues(myparameterValuesCollection)
** Log into the table(s) used by the report document object
** Run the export code, without using the Crystal Viewer
Since Im doing the export, theres no need to use the viewer. If you want the report to show in the browser window, you can simply use:
Response.ClearContent()
Response.ClearHeaders()
Select Case exportType
Case "PDF"
Response.ContentType = "application/pdf"
Case "EXCEL"
Response.ContentType = "application/vnd.ms-excel"
End Select
Response.WriteFile(exportFile)
Response.Flush()
Response.Close()
Delete the exported file from the hard disk
System.IO.File.Delete(exportFile)
The "Response.WriteFile(exportFile)" will write the file to the hard disk of the computer and based on how the computer handles the file type, it will ask to either open or download the file. Hope this makes sense. Keep the questions coming - I remember how frustrating it was when I was trying to get Crystal to work some time ago in .NET. I hope I can save you some time and trouble. Good luck!