Data not Loaded in reportviewer VB.NET

你离开我真会死。 提交于 2019-12-04 19:27:41

Currently you have passed a DataTable of a new instance of a DataSet to report data source. So obviously it should be empty and you will see report column headers without any data.

You should load data into the DataTable and then pass it to report.

For example, if you dropped a TableAdapter on your form, you can use such code:

Me.Table1TableAdapter.Fill(Me.DataSet1.Table1)
Dim rds = New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", Me.DataSet1.Table1)

Also

Dim cn = "Connection String"
Dim cmd = "Stored Procedre Name"
Dim table = New DataTable()
Using adapter As New SqlDataAdapter(cmd, cn)
    adapter.SelectCommand.CommandType = CommandType.StoredProcedure
    adapter.Fill(table)
End Using
Dim rds = New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", table)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!