Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2011, 01:02 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2009
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default Convert crystal report to pdf in web application with parameter

trying to preview a crystal report in pdf format in web application by passing parameter but showing error message :

crReportDocument.Export()
missing parameter value

<CODE>

Dim crExportOptions As ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim Fname As String

crReportDocument.Load(Session("rptFileName"))
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.ParameterFieldInfo.Clear()


Fname = "C:\Temp\Temp.pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

''''''''''''''''''''
If Session("rptType") = "PrintOption0" Then ' Without Parameter
' no need to do anything
ElseIf Session("rptType") = "PrintOption1" Then ' One Parameter
paramField.Name = "@UserID"
paramDiscreteValue1.Value = Session("rptParameter1")
paramField.CurrentValues.Add(paramDiscreteValue1)
paramFields.Add(paramField)
CrystalReportViewer1.ParameterFieldInfo = paramFields

End If
''''''''''''''''''''''

crReportDocument.Export()

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

' delete the exported file from disk
System.IO.File.Delete(Fname)

</CODE>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem using crystal report in web application CodeBest Crystal Reports 0 January 12th, 2009 07:51 AM
Convert Crystal Report 8 to PDF rsamanthif Crystal Reports 1 January 2nd, 2006 03:53 AM
crystal report web application abend edbrinkm Crystal Reports 1 July 8th, 2005 10:36 AM
Crystal Report Parameter BKunneke VB.NET 2002/2003 Basics 1 June 13th, 2005 09:47 AM
Convert dynamic PHP report to PDF and then email phishee Pro PHP 0 November 4th, 2004 03:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.