smartmm 发表于 2019-3-28 15:19:55

运行时数据绑定带参数问题

使用的是VR12报表,VB.NET开发,采用运行时数据绑定,在带参数时,参数带进去了,但是报表一直在运行却不显示结果,请问该怎么解决代码为:
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
      Dim rowid As String = Trim(Replace(Request.Params("id"), "'", ""))

      Dim rpt As New GrapeCity.ActiveReports.PageReport
      rpt.Load(New System.IO.FileInfo(Server.MapPath("") + "\\dy_jsx.rdlx"))
      rpt.Report.ReportParameters(0).DefaultValue.Values.Add(rowid)
      AddHandler rpt.Document.LocateDataSource, AddressOf Document_LocateDataSource

      WebViewer1.PdfExportOptions.FitWindow = False
      WebViewer1.PdfExportOptions.DisplayMode = GrapeCity.ActiveReports.Export.Pdf.Section.DisplayMode.Outlines
      WebViewer1.Report = rpt

    End Sub

    Sub Document_LocateDataSource(sender As Object, args As GrapeCity.ActiveReports.LocateDataSourceEventArgs) '查询

      If args.DataSourceName = "DataSource1" Then
            If args.DataSetName = "DataSet1" Then
                Dim rowid As String = args.Report.Parameters(0).CurrentValue.ToString()
                Dim dt As New Data.DataTable
                Dim sql As String
                sql = "select t.*, t.rowid from tx_jsx t where t.rowid='" & rowid & "'"
                dt = ds.sqldatt(sql)
                Dim a = dt.Rows.Count
                args.Data = dt
            End If
      End If
    End Sub


smartmm 发表于 2019-3-28 15:20:21

在报表中建立了rowid这个参数

smartmm 发表于 2019-3-28 15:25:19


KearneyKang 发表于 2019-3-28 16:37:51

这个需要你进行代码调试,看参数传递过去之后,报表返回的table值是否给报表绑定。单单看这个我不能很好的确定这个问题

smartmm 发表于 2019-3-29 08:19:26

我只要把报表设置那的参数删除掉,就能正常显示,下面的代码就能正常显示,是还有其他的设置么
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
      Dim rowid As String = Trim(Replace(Request.Params("id"), "'", ""))

      Dim rpt As New GrapeCity.ActiveReports.PageReport
      rpt.Load(New System.IO.FileInfo(Server.MapPath("") + "\\dy_jsx.rdlx"))

      AddHandler rpt.Document.LocateDataSource, AddressOf Document_LocateDataSource

      WebViewer1.PdfExportOptions.FitWindow = False
      WebViewer1.PdfExportOptions.DisplayMode = GrapeCity.ActiveReports.Export.Pdf.Section.DisplayMode.Outlines
      WebViewer1.Report = rpt


    End Sub
    Sub Document_LocateDataSource(sender As Object, args As GrapeCity.ActiveReports.LocateDataSourceEventArgs) '查询

      If args.DataSourceName = "DataSource1" Then
            If args.DataSetName = "DataSet1" Then

                Dim dt As New Data.DataTable
                Dim sql As String
                sql = "select t.*, t.rowid from tx_jsx t where t.rowid='AABAh9AAOAAACkPAAB'"
                dt = ds.sqldatt(sql)
                Dim a = dt.Rows.Count
                args.Data = dt
            End If
      End If
    End Sub

KearneyKang 发表于 2019-3-29 09:32:17

你是使用那种方式渲染的,你的页面中是不是引用了
< script language = "javascript" type = "text / javascript" SRC = "http://code.jquery.com/jquery-2.0.min.js"> </script>
这个Jquery文件的版本你给使用比较低的版本,因为高版本出现一个冲突,导致参数报表没法用

smartmm 发表于 2019-3-29 09:52:55

<script language="javascript" type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
    <script type="text/javascript">
用的这个,我机器上还装AR13么,用卸载掉么?

smartmm 发表于 2019-3-29 10:01:09

用了< script language = "javascript" type = "text / javascript" SRC = "http://code.jquery.com/jquery-2.0.min.js"> </script>进行渲染,参数是能进行传递了,但是前台打印导出的按钮就没了

KearneyKang 发表于 2019-3-29 14:21:46

你换 1.7.2试试,然后看看代码进没有进打印和导出的方法里。

KearneyKang 发表于 2019-3-29 14:44:48

用这个版本试试:<script language="javascript" type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.7.1/jquery.min.js"></script>
我刚刚测试了都是可以的
页: [1]
查看完整版本: 运行时数据绑定带参数问题