首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

水晶报表为什么没有刷新数据,该怎么解决

2012-01-19 
水晶报表为什么没有刷新数据水晶报表版本:11.5.0.313环境:vb.net2005、SQL2005,水晶报表问题:已经向报表文

水晶报表为什么没有刷新数据
水晶报表版本:11.5.0.313
环境:vb.net2005   、SQL   2005,水晶报表

问题:已经向报表文件传递参数,但报表确没有刷新数据。

代码如下:
      strRPTFile   =   GetReportPath( "GL ",   "Voucher.rpt ")

                                For   I   As   Integer   =   0   To   str.Length   -   1
                                        If   str(I).IndexOf( "= ")   >   0   Then
                                                If   str(I).Split( "= ")(0).ToUpper   =   "Server ".ToUpper   Then
                                                        srv   =   str(I).Split( "= ")(1)
                                                End   If

                                                If   str(I).Split( "= ")(0).ToUpper   =   "DataBase ".ToUpper   Then
                                                        db   =   str(I).Split( "= ")(1)
                                                End   If

                                                If   str(I).Split( "= ")(0).ToUpper   =   "Uid ".ToUpper   Then
                                                        user   =   str(I).Split( "= ")(1)
                                                End   If

                                                If   str(I).Split( "= ")(0).ToUpper   =   "Pwd ".ToUpper   Or   str(I).Split( "= ")(0).ToUpper   =   "Password ".ToUpper   Then
                                                        pwd   =   str(I).Split( "= ")(1)
                                                End   If



                                        End   If
                                Next


                                Dim   ReportDoc   As   New   ReportDocument()
                                Dim   logonInfo   As   New   TableLogOnInfo
                                Dim   table   As   Table
                                ReportDoc.Load(strRPTFile)
                                '设置登录信息
                                For   Each   table   In   ReportDoc.Database.Tables
                                        logonInfo   =   table.LogOnInfo
                                        With   logonInfo.ConnectionInfo
                                                .ServerName   =   srv
                                                .DatabaseName   =   db
                                                .UserID   =   user
                                                .Password   =   pwd
                                        End   With
                                        table.ApplyLogOnInfo(logonInfo)

                                Next

                                With   ReportDoc

                                End   With

                                ReportDoc.SetParameterValue( "@Fvoucherid ",   strFvoucherid)

                                With   My.Forms.Frm_Report.CrystalReportViewer1
                                        .ReportSource   =   ReportDoc


                                        .DisplayGroupTree   =   False

                                End   With
                                My.Forms.Frm_Report.ShowDialog()

                        End   If

但同样类似的代码处理其他报表又可以。不知是代码有问题还是水晶报表的设置有问题。

[解决办法]
ReportDoc.SetParameterValue( "@Fvoucherid ", strFvoucherid)
ReportDoc.Refresh();//加上这句

With My.Forms.Frm_Report.CrystalReportViewer1
.ReportSource = ReportDoc
.DisplayGroupTree = False

End With

热点排行