找遍因特网,谁能解决此.NET报表问题
这是一个报表参数传递的问题,设计环境:WIN XP + + .NET 自带报表在传递报表参数时出现了错误提示:“本地报表处理期间出错。”——未处理LocalProcessingException
以下是我的过程全部代码
Public Sub PrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreview.Click
Dim OleOata As New OleDb.OleDbDataAdapter("SELECT * FROM 员工信息 where 员工编号='" & 员工编号TextBox.Text & "'", OleConn)
Dim datasett As New DataSet
Dim ViewReport As New FrmPriview '打印预览窗体
OleConn.Open()
OleOata.Fill(datasett)
Dim rds = New ReportDataSource("xswsDataSet_员工信息", datasett.Tables(0))
Dim sCanSu As ReportParameter
Dim paramList As New Generic.List(Of ReportParameter)
sCanSu = New ReportParameter("StrDanWei", "注册公司", True)
paramList.Add(sCanSu)'定义参数并赋值
Application.DoEvents()
With ViewReport
.Validate()
.ReportViewer1.LocalReport.DataSources.Clear()
.ReportViewer1.LocalReport.DataSources.Add(rds)
.ReportViewer1.LocalReport.ReportPath = StrPath() + "Report\Report1.rdlc"
.ReportViewer1.LocalReport.SetParameters(paramList)'传递报表参数,问题就出现在这一句,设计时没问题,运行时出错.这一句注释掉报表正常显示,但参数仍未能传递过来。出错提示上面已经写了 .ReportViewer1.LocalReport.Refresh()
.ShowDialog()
End With
OleConn.Close()
End Sub