Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Export PDF from Crystal Report .NET using ASP.NET

Reply
Thread Tools

Export PDF from Crystal Report .NET using ASP.NET

 
 
=?Utf-8?B?c3VpY2lkYWx0ZW5kZW5jaWVz?=
Guest
Posts: n/a
 
      02-05-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report Export to PDF Inline Fails emarvets@gmail.com ASP .Net 0 03-29-2006 06:00 PM
Export Crystal Report to PDF and open it in Acrobat Reader instead of Internet Explorer Dave ASP .Net 0 12-15-2004 04:54 PM
Error when attempting to export Crystal Report as PDF document asp.net Colin Graham ASP .Net 0 11-17-2004 05:32 PM
FAIL TO LOAD THE CRYSTAL REPORT USING WEB CRYSTAL REPORT VIEWER Comfort ASP .Net Web Controls 0 10-18-2004 01:35 PM
Export from crystal report to pdf =?Utf-8?B?TWFuZGFy?= ASP .Net 4 08-12-2004 10:51 PM



Advertisments