Crystal Report - 数据未显示在报表上但在数据集中包含数据

时间:2017-07-12 07:51:11

标签: vb.net printing crystal-reports

我正在使用VB.Net中的CR 13创建报告。

经测试,即使数据集中有数据,报告中也不会显示数据。

没有抛出任何错误,它只显示一个没有数据的空白模板。

感谢。

已更新

这是代码。

Dim dt As New DataTable
        m_ReportClass = New CustomReports
        With ctrlRptViewer
            dt = m_ReportClass.GetDOSRI(entityID, reportDate, isConsolidated)

            Dim isHeadOffice As Boolean = False

            isHeadOffice = (Current.Entity.Code.Count = 4)

            .ReportTitle = "xxxx"
            .ReportParams = {
                    "report_header1=" & IIf(Not isHeadOffice, Current.Entity.Name, ctrlEntity.NameEntity) & " - DOSRI REPORT",
                    "report_header2=FOR THE MONTH OF " & MonthName(Month(dtpDate.Value)) & " " & Year(dtpDate.Value)
                }
            .ReportData = dt
            If isConsolidated Then
                .ReportFile = REPORTS_PATH & "\x\y.rpt"
            Else
                .ReportFile = REPORTS_PATH & "\x\y.rpt"
            End If

            .ShowReport()
        End With

对于ShowReport方法。

 DisposeReportSource()

        If ReportFile <> "" Then
            ReportSource = New ReportDocument
            ReportSource.Load(ReportFile, CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault)

            SetDataSource(ReportSource, ReportData, ReportTitle, ReportParams)
        Else
            SetDataSource(ReportSource, ReportTitle, ReportParams)
        End If
        crvViewer.ReportSource = ReportSource
        crvViewer.Refresh()

1 个答案:

答案 0 :(得分:0)

As you haven't provided the code, I'm assuming you are not refreshing the crystal report instance after filling it with your dataset source. Try this at last :

CrystalReport.Refresh()