Skip to Content
Former Member
Jan 07, 2011 at 10:43 PM

VS2008 CR basic Data not saving with report


I have a Windows forms app with a CR developed in VS2008. The report displays correctily in the report viewer control and I also save it as a .rpt file. When I open this file in Crystal Reports Viewer 2008 I get the error that there is no saved data. The data source for the report is a DataView. Here is my code:

' set sort key of Rpt1Ds view

If Me.radRptSeqn.Value = "A" Then

sortKey = "Account ASC, Contract ASC"

ElseIf Me.radRptSeqn.Value = "C" Then

sortKey = "Contract ASC"

ElseIf Me.radRptSeqn.Value = "N" Then

sortKey = "Surname ASC, Contract ASC"

End If


Dim dv1 As DataView = New DataView(Me.Rpt1Ds.Tables(0), "", sortKey, DataViewRowState.CurrentRows)

dv1.Table.TableName = "RRIFYePaymentsTable"


Dim dv2 As DataView = New DataView(Me.Rpt1Ds.Tables(1), "", "TotPymtFreq ASC", DataViewRowState.CurrentRows)

dv2.Table.TableName = "RRIFYePaymentsSummaryTable"


CRpt1.SetParameterValue("CUName", cuname)

CRpt1.SetParameterValue("SystemDateOR", MainForm.MySystemDate)

CRpt1.SetParameterValue("AccrualDate", Me.dtpIntAcrlDate.Value)

CRpt1.SetParameterValue("RptTitle", "RRIF ANNUAL PAYMENTS")

CRpt1.SetParameterValue("IsDetailed", Me.chkRptDetail.CheckedValue)

If Me.radRptDest.Value <> "F" Then

CRpt1.PrintOptions.PrinterName = Me.cmbPrinter.Text

End If

CRpt1.ReportOptions.EnableSaveDataWithReport = True

CRpt1.ReportOptions.EnableSaveSummariesWithReport = True

rptViewer.CrystalReportViewer1.ReportSource = CRpt1

rptViewer.CrystalReportViewer1.Zoom(1) ' set to page width


If Me.radRptDest.Value = "F" OrElse Me.radRptDest.Value = "B" Then

fileName = "RrifYePymts" & dateText & ".rpt"

Me.RptFullPath = SaveRSPReportFile(fileName, CRpt1)

End If