我正在开发 Winform 应用程序,我是 Reports (rdlc) 的新手。我想从数据库中获取数据并将它们设置为我的代码报告的数据源。我正在使用 Vb.net,以下是我尝试过的代码...
Dim conn As OleDbConnection
Dim adpt As OleDbDataAdapter
Dim rs As DataTable
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
conn = New OleDbConnection
conn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\tblentries.mdb"
conn.Open()
adpt = New OleDbDataAdapter("select * from tblentries", conn)
rs = New DataTable
adpt.Fill(rs)
Dim ds As DataSet = New DataSet("DataSetOne")
ds.Tables.Add(rs)
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("Report1", ds.Tables(0)))
ReportViewer1.LocalReport.Refresh()
Me.ReportViewer1.RefreshReport()
End Sub
结果我得到的是空白报告请建议我是报告新手,我发布的代码是从谷歌引用的。谢谢,我在等。。。。。。