0

我在创建 RDLC 报告时遇到错误,该报告参数 rpP 缺少一个值(请参阅附件图像)。我已经检查了 rpP & rpP 有来自数据库的值。

尽管当我(手动)单击刷新按钮时,它会正确显示所有数据。在调试参数时,rpP 已被赋值。但我不知道为什么它显示此错误。

代码:

            For Each drBody As DataRow In ds.Tables(0).Rows
            pName1 = CType(drBody("Name"), String)
            Me.ReportViewer1.LocalReport.Refresh()
            'ReportViewer1.LocalReport.ReportPath = Application.ExecutablePath
            Dim PICpATH As String = CType(drBody("ImagePath"), String)
            Dim passport As String = CType(drBody("PassportNo"), String)
            Dim arrParam(22) As ReportParameter
            arrParam(0) = New ReportParameter("rp", pName1.ToString(), True)
            **arrParam(1) = New ReportParameter("rpP", passport, True)**
            arrParam(2) = New ReportParameter("rpSocIncNo", CType(drBody("SocIncNo"), String), True)
            arrParam(3) = New ReportParameter("rpMartialStstus", CType(drBody("MartialStstus"), String), True)
            arrParam(4) = New ReportParameter("rpChildren", CType(drBody("Children"), String), True)
            arrParam(5) = New ReportParameter("rpChildrenAges", CType(drBody("ChildrenAges"), String), True)
            arrParam(6) = New ReportParameter("rpEmploymentDate", CType(drBody("EmploymentDate"), String), True)
            arrParam(7) = New ReportParameter("rpOccupation_Full", CType(drBody("Occupation_Full"), String), True)
            arrParam(8) = New ReportParameter("rpDepartment", CType(drBody("Department"), String), True)
            arrParam(9) = New ReportParameter("rpPosition", CType(drBody("Position"), String), True)
            arrParam(10) = New ReportParameter("rpJobDescription", CType(drBody("JobDescription"), String), True)
            arrParam(11) = New ReportParameter("rpLandline", CType(drBody("Landline"), String), True)
            arrParam(12) = New ReportParameter("rpMobile", CType(drBody("Mobile"), String), True)
            arrParam(13) = New ReportParameter("rpStreet", CType(drBody("Street"), String), True)
            arrParam(14) = New ReportParameter("rpDistrict", CType(drBody("District"), String), True)
            arrParam(15) = New ReportParameter("rpTown", CType(drBody("Town"), String), True)
            arrParam(16) = New ReportParameter("rpPostalCode", CType(drBody("PostalCode"), String), True)
            arrParam(17) = New ReportParameter("rpInsurance", CType(drBody("Insurance"), String), True)
            arrParam(18) = New ReportParameter("rpStart", CType(drBody("Start"), String), True)
            arrParam(19) = New ReportParameter("rpEndDate", CType(drBody("EndDate"), String), True)
            arrParam(20) = New ReportParameter("rpDisablilities", CType(drBody("Disablilities"), String), True)
            arrParam(21) = New ReportParameter("rpdob", CType(drBody("DoB"), String), True)
            arrParam(22) = New ReportParameter("rpNationality", CType(drBody("Nationality"), String), True)
            Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {arrParam(0), arrParam(1), arrParam(2), arrParam(3), arrParam(4), arrParam(5), arrParam(6), arrParam(7), arrParam(8), arrParam(9), arrParam(10), arrParam(11), arrParam(12), arrParam(13), arrParam(14), arrParam(15), arrParam(16), arrParam(17), arrParam(18), arrParam(19), arrParam(20), arrParam(21), arrParam(22)})
        Next
        ReportViewer1.LocalReport.DataSources.Clear()
        ReportViewer1.LocalReport.DataSources.Add(rds)
        Me.ReportViewer1.LocalReport.Refresh()

http://i.stack.imgur.com/Ebfmv.png

另外,我如何导出到 EXCEL 文件或在 Excel 文件中打印。

谢谢

4

0 回答 0