''' <summary>
''' 2019.7.4
''' 数据源加载程序
''' </summary>
''' <param name="sender"></param>
''' <param name="args"></param>
Private Sub OnLocateDataSource(ByVal sender As Object, ByVal args As GrapeCity.ActiveReports.LocateDataSourceEventArgs)
If args.DataSourceName = "binbin" Then
' Dim vConnection As New GrapeCity.ActiveReports.PageReportModel.ConnectionProperties
' vConnection.ConnectString = _nConnection1
If args.DataSetName = "DataSet1" Then
args.Data = _nMainDataSource1
End If
End If
End Sub
''' <summary>
''' 2019.7.4
''' 加载报表
''' </summary>
''' <returns></returns>
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) '..\..\Report\ShippingInstructions.rdlx")
Dim definition As New PageReport(rptPath)
' definition.Report.DataSources(0).ConnectionProperties.DataProvider="OLEDB"
definition.Report.DataSources(0).ConnectionProperties.ConnectString = _nConnection1 '自定义数据源连接信息 2019.7.5
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
上面是2段代码,我吧我需要输出的数据,打包成datatable ,既_nMainDataSource1,输出报表,显示的效果不是这样。
我吧我做的模板,打包上来。
是我这个报表做的有问题,还是说,我一样还是需要传输一条语句进去。
|