Please Help. getting error while exporting crystal reports to .pdf

Hi everyone,

Can anyone please tell me why my crsytal reprt is giving me this error:
Invalid file name.
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: Invalid file name.
I have win xp
and this is my code
Dim oConnection As New SqlClient.SqlConnection("server=(local); database = Med; Trusted_connection=yes ")
oConnection.Open()
Dim contentType As String
Dim oCommand As New _
SqlClient.SqlCommand("select * from tmpRptCheckRegister", oConnection)

Dim ds As New DataSet()
Dim oDataAdapter As New SqlClient.SqlDataAdapter(oCommand)
oDataAdapter.Fill(ds, "oClaims")
Dim rpt As New CrystalReport1()
rpt.SetDataSource(ds.Tables("oClaims"))
CrystalReportViewer1.ReportSource = rpt
' export to .pdf file
Dim myExportFile As String
myExportFile = Request.PhysicalApplicationPath & "Exported\\" & Session.SessionID.ToString() & ".pdf"
Dim myExportOptions As New ExportOptions()
Dim myDiskFileDestinationOptions As DiskFileDestinationOptions
myDiskFileDestinationOptions = New DiskFileDestinationOptions()
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = rpt.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
contentType = "application/pdf"

End With
rpt.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.AddHeader("content-disposition", "attachment; filename = " & myExportFile)
Response.ContentType = contentType
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()
Response.End()

System.IO.File.Delete(myExportFile)

Thanks for any help.
0
vinki
3/21/2004 5:47:46 AM
asp.net.crystal-reports 7043 articles. 0 followers. Follow

1 Replies
1065 Views

Similar Articles

[PageSpeed] 24

Is Exported a directory below your path?  Either step through the lines of code in the Visual Studio debugger, or write out the variable myExportFile to see what path it's writing to.  Also, make sure that ASPNet User can write to that folder (has permissions).  Hope that helps.
Eric Landes

MADNUG President http://www.madnug.net
Crystal Alliance Editor
Blog http://aspadvice.com/blogs/elandes
Microsoft MVP
0
ericlandes
3/22/2004 4:47:26 PM
Reply:

Similar Artilces:

Converting Crystal Reports 9 report to Crystal Reports .NET report
I have a web page that is supposed to display a crystal report.  The report is fully written and functional in crystal 9 (non-.Net)  .  Is there a way to convert my .rpt so that I can just include it in the new web site? why you don't try to compile project with .net and include your report. then if crystal report is power tool will suggests you with conversation tool    My blog is here.Please remember to 'Mark as Answer' if this post answered your question! Wow it really was that easy!  I just added the old crystal report into my .NET proj...

Cassini, VS.Net and Crystal Reports
Hi,I am working with Win XP home, Cassini and VS.Net.I would like to play with some Crystal Reports.I create the report in VS as CrystalReport1.I put a CrystalReportViewer on my web form. It does not get recognized as a defined object type but there are no build errors.When I run the app I get an error: Type 'CrystalReport1' is not defined.I have googled on this and see several things people have suggested/tried to correct this. Most I have already tried or the suggestions are not very clear to me. Then I came across a msg that instructed me to set up virtual directories for IIS for CrystalR...

crystal reports .net -> crystal reports .net 2003
recently converted a project from .net to .net 2003. The 2 crystal reports I had in the project do not load when executing the application. The project itself within 2003 will allow me to multiplat the crystal reports, however when it comes to execution time I get the error: Invalid Data Source. If this isn't the right forum please point me to the right one as this is really the only website I know of with a large reader base. >to multiplat the crystal reports To what the crystal reports? Do you have the same database connections established and verified in your 2003 s...

Help please
 Hi everyone,I'm kind of new in ASP.NET and i have this project where i have to convert a gridview into a PDF file, but this was getting very difficult so i decided to use a crystal report instead. Which now leads me to a an other question. In my page i can use the (drag and drop) CrytalreportViewer and then export to PDF, but i was thinking of something different. What i wanted to do was still had the gridview but add just below a "Export to PDF" button, that would export the content of the gridview (which is the same of the crystalreport) to PDF.  What i me...

Export Crystal Report to Crystal Report format
I looked at some sample code provided by crystaldecisions, and they have the ability to export a web crystal report to a crystal report. I was assuming that this would cause the local instance of Crystal reports on the client machine to be invoked. I tried this in my project, and I get the following error: Error Encountered by Crystal Web Report Server -------------------------------------------------------------------------------- The error message returned is: Connection to Report Server Failed. It creates the file as an .rpt file in the directory it should. Do I need a dif...

Crystal Report.NET: Error occurred when export to PDF
I encountered this error when attempting to export a report to PDF in a Window Form application: System.NotSupportedException: Error in File C:\DOCUME~1\tnguyen1\LOCALS~1\Temp\temp_a605641b-1f63-401d-b8e3-710c095306bd.rpt: Operation not yet implemented. at .A(Int16 , Int32 ) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export() at WinFormReport.ReportManager.ExportToPdf(ReportDocume...

Export Crystal report to PDF report
Hello, Does anyone knows how to export the Crystal report (.rpt) to the PDF report in c#?  Thanks  http://www.beansoftware.com/ASP.NET-Tutorials/Export-Crystal-Reports-To-PDF.aspxhttp://visualbasic.ittoolbox.com/groups/technical-functional/visualbasic-l/programmatically-exporting-from-crystal-report-to-pdf-using-vb-1480987http://www.codeproject.com/KB/vb/JatsArticle1.aspx  Don't say thanks rather mark my reply as "Answer" if it helps you ,Doing so u'll get points tooamiT jaiNC#.NET Articles Hi, You can use the following  rptDoc.ExportToHttpRespons...

Need code to export Crystal report to PDF
 Hello.  We are getting random error whenever we run the code below.  It is happening at line 46.  I was wanting to just rewrite this so we don'tget the error anymore.  Since it is happening sporadically we'd like to just remove the code and replace it with something else.   Can anyone help with this?  It would be greatly appreciated!  :) cpeaut32 error '800a502e' Error in File D:\Inetpub\wwwroot\Form\register\Admin\Reports\AdminActivities.rpt: No default printer. /register/Admin/SharedCode/inc_eRegAdminReport.asp, line 46 I a...

Export Crystal Report To PDF,RTF,DOC files--> please help me
Edited by SomeNewKid. Please post code between <code> and </code> tags. I can use this code when I tested on my localhost-->But cannot use on server-->It show "runtime error " Sub Export_DAta()--> export button Try Dim crReport As New workTime Dim CrExportOptions As ExportOptions Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions CrExportOptions = crReport.ExportOptions Dim exFileName As String Select Case ddlDoc.SelectedItem.T...

Errors with all my reports after upgrade from Bundeled Crystal.NET (VS2003) to Crystal XI Developer for .NET
All my Crystal reports were developed using the bundled Crystal in VS 2003.  I just installed the Crystal XI for .NET Developer version that we purchased and now I get an error when running my reports.  (I am running them in debug mode on my development machine). I have tested it on several different reports.  I did not change the code, this worked fine in the previous version. First I reference my report (AccountList is the AccountList.rpt report that is in my project): Dim myReport As New AccountList Then I start rolling through the report's tables to update the log...

integration of Crystal Report with .NET ; crystal report viewer not displaying in Toolbox
Hi I m new to Visual Web Developer 2005 Express Edition. I want to integrate Crystal Report with .NET. In my Toolbox , Crystal Report Viewer is not displaying. How to make it possible? + How to call my report from asp.net 2.0. Need source code plz.*Share Knowledge Every TIME Crystal Reports for .NET does not come with VWD Express.  It only comes with VS 2005 Professional (I'm not sure about the Standard edition).If you have Crystal Reports 10 or XI, you can installed the .NET libraries for Crystal and then use them within VWD Express, noting that you have to build your reports ...

Crystal reports error when exporting to pdf....
Can anyone give me any suggestions?? It works on the local machine but when it is on the web server it crashes when I try and export. What folder do I have to set permissions to. I have done add view modify to the IIS folder where the app lies is there somewhere else I have to put this as well. PLEASE HELP!!! Here is the code on the button and the error.crReportDocument = New ReportDocument         crReportDocument.Load("\Inetpub\wwwroot\WebApp\CrystalReport2.rpt")         Fname = "c:\exports" & Session.Sessi...

Crystal report Export to pdf error
Hi I have CR 11 to develop my reports and display them in .Net 2005 . The printing option works only for Activex (manually changed the Printmode setting to activex ) . Both export to pdf and printing using pdf is not working for me. Please help  What version crystal report you are using?  When you export into PDF what problem you are facing?If this post is answer of your question then don't forgot to Click Mark As Answer  I use Crystal reports 11 . When i click on export button, i see a list of options (formats) , when i select pdf , the pdf window opens wi...

HELP! How to export crystal report to pdf?
Hi All: I have a report file named Report1.rpt, I then exported it into a .pdf file named Report1.pdf. This is the code I've added when I click on a button: Dim strExportFile As String strExportFile = "Report1.pdf" ' Send user to PDF report Response.Redirect(strExportFile) After I clicked on the button, the page displayed Report1.pdf, which is good, but what if I didn't want to export the crystal report file to pdf file at the first place? I mean, can I export .rpt to .pdf with coding? (Instead of doing it manually) If yes, please show me how. Oh, and what if I want it this way: when I...

Web resources about - Please Help. getting error while exporting crystal reports to .pdf - asp.net.crystal-reports

Gas Exporting Countries Forum - Wikipedia, the free encyclopedia
The Gas Exporting Countries Forum ( GECF ) is an intergovernmental organization of 11 of the world's leading natural gas producers made up of ...

Facebook Updates Comments Box Plugin With Comment Exporting and Larger News Feed Stories
Facebook today released several updates to the newest version of its Comments Box social plugin for third party websites that will increase the ...

Lower dollar a boon for Canberra's wine exporting king
It may mean more expensive holidays for some, but one ACT registered company has enjoyed a profitable time thanks to the sharp fall in the Australian ...

Irish plant shut for exporting horsemeat
Sky News is Australia's leader in 24-hour news.

New online freight marketplace Cargohound aims to be the Uber of exporting
Cargo Hound wants to revolutionise the way goods are shipped from Australia.

Exporting the desperate; out of sight ... and mind
The boats have stopped, the point's been made, so why continue to treat those already ''here'' with such unconscionable cruelty?

Meat market: Andrew Forrest sees fortune in exporting beef to China
China is so desperate for good beef that Australian billionaire Andrew Forrest will be taking sample parcels of steak in his luggage on his next ...

Exporting carbon and hypocrisy: our big growth industry
Never mind our modest cuts to local emissions, new research shows Australia is heading into a carbon export boom.

Montreal men accused of illegally exporting railway equipment to Iran
Two Montreal men are charged with illegally exporting American-made railway equipment to Iran, violating Canada's Export and Import Permit Act ...

Lee Specialties Ltd. Charged With Exporting Prohibited Commodity To Iran
CALGARY - Putting the wrong address on a $15 shipment of synthetic rubber rings has cost an Alberta company $90,000 for violating legislation ...

Resources last updated: 11/25/2015 4:15:45 PM