reports.vb

来自「wrox出版社的另一套经典的VB2005数据库编程学习书籍,收集了书中源码,郑重」· VB 代码 · 共 43 行

VB
43
字号
Option Explicit On
Option Strict On
Imports System
Imports System.Data
Imports Microsoft.Reporting.WinForms

Public Class Reports
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'NorthwindDataSet.Employees' table. You can move, or remove it, as needed.
        Me.NWEmployeesTableAdapter.Fill(Me.NorthwindDataSet.NWEmployees)
        AdventureWorksDataset.EnforceConstraints = False
        Me.AwEmployeesTableAdapter.Fill(Me.AdventureWorksDataset.AWEmployees)
        Me.NwOrders1997TableAdapter.Fill(Me.NorthwindDataSet.NWOrders1997)

        With Me.rvNWEmployees
            .RefreshReport()
        End With

        With Me.NWOrders1997BindingSource
            Dim strSource = .DataSource
            Dim strMember = .DataMember
        End With

        Me.rvAWEmployees.RefreshReport()
        With Me.rvAWCategories
            'DataSet for the report's DataSource
            Dim dsAwCats As New DataSet
            Dim strPath As String = Application.StartupPath
            strPath = Replace(strPath, "bin\Debug", "")
            'Optionally, load the client report definition file (if new)
            .LocalReport.ReportPath = strPath + "AWCategories.rdlc"
            'Create a single-table dataset from the XML document
            dsAwCats.ReadXml(strPath + "AWCategories.xml")
            'Assign the DataTable as the DataSource for the report
            .LocalReport.DataSources.Add(New ReportDataSource("Sales", dsAwCats.Tables(0)))
            'Refresh the report with the new data
            .RefreshReport()
        End With
        Me.rvNWOrders1997Local.RefreshReport()
        Me.rvNWOrders1997Chart.RefreshReport()
    End Sub

End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?