我想知道如何使用报表查看器在VB.NET中创建报表,如创建数据报表?
我尝试了我在互联网上找到的所有内容,但大部分内容都是使用报告向导。我想要类似于在VB 6.0中创建报告。
这是我到目前为止所尝试的......
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO
Public Class frmTestReport
Public dsMyDataSet As New DataSet()
Private Sub frmTestReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.cmbReport.Items.Add("TESTREPORT")
Me.ReportViewer1.RefreshReport()
End Sub
Private Sub btnViewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewReport.Click
Me.ReportViewer1.Reset()
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
If Me.cmbReport.Text.Trim() = "TESTREPORT" Then
'load .rdlc file and add a datasource
Me.ReportViewer1.LocalReport.ReportPath = "C:\Reports\MyTestReport.rdlc"
' ReportViewer1.LocalReport.DataSources.Add(ds)
End If
'refresh viewer with above settings
Me.ReportViewer1.RefreshReport()
End Sub
End Class
编辑:我想用动态数据集填充我的report.rdlc,以便我可以附加我想要的SQL查询但没有运气,...目前我的报告返回空白报告。