【发布时间】:2017-10-11 22:49:10
【问题描述】:
我在 Windows 应用程序中使用 Crystal Reports 14.2.2.1975 和 Visual Studio 2015。
我已经能够根据与数据表匹配的字段定义成功创建报告。报告打印完美,并且可以正确预览 - 但是 - 当尝试在查看器中使用刷新或分页控件时,它会再次提示我输入所有报告参数,然后显示示例数据而不是请求的页面。
设置查看器的代码是从另一个对话框窗体 (FrmPrint) 调用的。 FrmPrint的“预览”按钮中的相关代码是……
Dim crxReport As New ReportDocument
crxReport.Load("<path>\Sample Report.rpt")
...
<a dataTable (dt) is created and loaded with the proper data>
...
' Set the data source of the report to that dataTable
crxReport.Database.Tables(0).SetDataSource(dt)
' Prepare to preview the report
(viewer contained on a separate form, "FrmReportPreview")
With FrmReportPreview
.Text = "My report name"
.CrystalReportViewer1.ReuseParameterValuesOnRefresh = True
.CrystalReportViewer1.ReportSource = crxReport
.CrystalReportViewer1.Show()
End With
' Show the report preview window
FrmReportPreview.Show()
【问题讨论】:
标签: crystal-reports