
Adding Parameters to a report - CR.NET
Set the parameters using the properties of the ReportDocument object and
then call the PrintToPrinter() method (also of the ReportDocument object).
See my free ebook for lots of code.
A Crystal Reports.NET book for programmers? Its free!
* Covers ASP.NET and Windows Forms
* Teaches all phases of report development
* Alerts you to the bugs and how to get around them
* Maps out the complex ReportDocument object model
* Shows how to perform runtime customization
* Demonstrates all options of connecting with ADO.NET
* Gives complete code listings for every concept presented
www.CrystalReportsBook.com?cpgn=ngcr_052703
HTH,
Brian Bischof
Quote:
> I have an asp.net page which i want to export a crystal report which
> requires parameters to pdf. I can get this to work no problem with reports
> that dont take any parameters. The problem i have is when the report needs
> parameters.
> I can display the report on a web form using the CrsytalReportViewerr and
> setting the ParameterFieldInfo property as below.
> ===================================
> Dim cr As New Print_rpt()
> Dim paramField As New ParameterField()
> Dim paramFields As New ParameterFields()
> Dim paramDiscreteValue As New ParameterDiscreteValue()
> Dim paramValues As New ParameterValues()
> paramDiscreteValue.Value = "0000000682"
> paramValues.Add(paramDiscreteValue)
> paramField.CurrentValues = paramValues
> paramFields.Add(paramField)
0
Quote:
> 0000682")
> CrystalReportViewer1.ParameterFieldInfo = paramFields
> CrystalReportViewer1.ReportSource = cr
> ==========================================
> That works no problem. But i dont want to display the report I want to
just
> export the report. If the report had no parameters I would use the code
> below to produce the export.
> =============================================================
> Dim dfdoCustomers As New
> CrystalDecisions.Shared.DiskFileDestinationOptions()
> 'dfdoCustomers.DiskFileName = "filename.pdf"
> Dim cr As New AddressLabels()
> 'With cr
> ' .ExportOptions.ExportDestinationType =
> CrystalDecisions.Shared.ExportDestinationType.DiskFile
> ' .ExportOptions.ExportFormatType =
> CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
> ' .ExportOptions.DestinationOptions = dfdoCustomers
> ' .Export()
> 'End With
> ==================================================================
> But how would i add parameters to this export code if the report required
> parameters. Am i completely on the wrong lines. Do I have to use a
> CrsytalReportViewer if i wish to pass parameters to the report?
> Thanks in advance. Any help would really be appreciated.
> Thanks
> Ant