473,395 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Export PDF from Crystal Report .NET using ASP.NET

I'm able to view the report, but when I click the button on the webpage that shows the report to export into a different format it gives me an error on Export. Any help would be great

I keep getting the following error

Logon failed.
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.LogOnExcept ion: Logon failed

Source Error:

Line 95: myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
Line 96: myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
Line 97:
Line 98: report.Export()
Line 99:

HERE IS MY CODE

private void Page_Load(object sender, System.EventArgs e

report = new MainProject.Reporting.crcustomerreport()

// Create connectio
SqlConnection objConn = new SqlConnection(ConfigurationSettings.AppSettings"Co nnectionString")
SqlCommand myCommand = new SqlCommand("getCustomersNoOwnerIDReturned", objConn)
myCommand.CommandType = CommandType.StoredProcedure

SqlParameter parameterOwnerID2 = new SqlParameter("@OwnerID", SqlDbType.VarChar, 50);
parameterOwnerID2.Value = (string)Session"OwnersUserName"
myCommand.Parameters.Add(parameterOwnerID2)

SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand)

MainProject.Reporting.dscustomerreport ds = new MainProject.Reporting.dscustomerreport()
myAdapter.Fill(ds, "Customers")

report.SetDataSource(ds)

CrystalReportViewer1.DisplayGroupTree = false
CrystalReportViewer1.DisplayToolbar = false

CrystalReportViewer1.ReportSource= report;
private void btnExport_Click(object sender, System.EventArgs e

ExportOptions myExportOptions
DiskFileDestinationOptions myDiskFileDestinationOptions

string myExportFile
report = new MainProject.Reporting.crcustomerreport()
myExportFile = @"C:\temp\" + Session.SessionID.ToString() + ".pdf"

myDiskFileDestinationOptions = new DiskFileDestinationOptions()

myDiskFileDestinationOptions.DiskFileName = myExportFile

myExportOptions = report.ExportOptions

myExportOptions.DestinationOptions = myDiskFileDestinationOptions
myExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
myExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat

report.Export()

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()

System.IO.File.Delete(myExportFile)

Can anyone tell me what I need to do to fix this problem. I'll need details, I'm new to Crystal Reports .NET

Thanks
Harold
Nov 18 '05 #1
0 1812

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Colin Graham | last post by:
Error when attempting to export Crystal Report as PDF document asp.net. I get the following error. Error in File...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
1
by: John | last post by:
Hi. Sir: Does anyboday know how to export subreport data using the export button in crystal report tool bar? We have a main report including a on-demand report. When we click the on-demand...
4
by: Mandar | last post by:
I am trying to export crystal report to pdf. but i am getting folloing error: "Error in File C:\DOCUME~1\MKM-BA~1\ASPNET\LOCALS~1\Temp\temp_0c6b2c59-df8a-4b26-a570-a2189ee212ac.rpt: Access to report...
0
by: Leonard Danao | last post by:
Anyone have any ideas as to why this is happenning. There are no other versions of Crystal installed aside from the one that came with vs2003 enterprise. the error happens when the...
1
by: ElanKathir .S.N | last post by:
Hollo Guys, I want to export my crystal reports (Crystal Report 9.0) to word format using visual basic 6.0. Means I want to export the reports with out preview. Now showing report using...
0
by: Alison Givens | last post by:
Hi all, I have been suffering with this problem for weeks now. I tried several newsgroups, but nobody can tell me how to solve this problem. The problem: I have a webform that shows a Crystal...
3
by: Brad | last post by:
In a Vista/IIS7 asp.net app, a coded crystal report export is crashing IIS7....but it works just fine in visual studio's cassini web server. And if I create a web form and use the crystal...
0
by: netlady | last post by:
Hi, can someone help me or share his or her idea why I am always getting a blank web page whenever I click the export button or the navigational next toolbar of the crystalreportviewer in .net ? I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.