Search code examples
vb.netprintingcrystal-reports

Crystal Report - Data not showing on report but has data in dataset


I am creating a report using CR 13 in VB.Net.

Upon testing, there is no data displayed in the report even though there is a data in the dataset.

There were no errors thrown, it just display a blank template with no data.

thanks.

UPDATED

Here is the code.

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

And for the ShowReport Method.

 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()

Solution

  • 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()