chenfeng1029 发表于 2019-7-5 10:15:08

activeReport代码运行后自动改动数据源。

这个是我加载报表的函数
    Public Function LoadReport() As Integer
      Dim intsuc As Integer = -2
      Try
         ’ Dim strFielName As String = System.Environment.CurrentDirectory + "\Report\ShippingInstructions.rdlx"
            Dim rptPath As New FileInfo(_nReportFileName1 )
            Dim definition As New PageReport(rptPath)
          definition.Report.DataSources(0).ConnectionProperties.ConnectString=_nConnection1'自定义数据源连接信息
            AddHandler definition.Document.LocateDataSource, AddressOf OnLocateDataSource'添加动态数据源事件,进行事件加载
            
            ReportView.LoadDocument(definition.Document)
            intsuc=1
      Catch ex As Exception
            MsgBox(ex.Message)
      End Try
      Return intsuc
    End Function



我在加载报表时候,改变了数据源,但最后预览报表的时候还是报错。


KearneyKang 发表于 2019-7-5 10:15:09

本帖最后由 KearneyKang 于 2019-7-5 17:51 编辑

你好,你是想后台修改数据源的链接是吧,具体可以参考这个博客:https://gcdn.grapecity.com.cn/fo ... 1307&extra=page%3D3

chenfeng1029 发表于 2019-7-5 16:44:17

ok

KearneyKang 发表于 2019-7-5 17:51:25

:)
页: [1]
查看完整版本: activeReport代码运行后自动改动数据源。