将手动创建的数据集绑定到vb.net 2.0报告 [英] bind manually created dataset to vb.net 2.0 report

查看:55
本文介绍了将手动创建的数据集绑定到vb.net 2.0报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手动创建了一个数据集,并创建了一个数据表价格表。 reportviewr位于一个用户控件ucReport中,它在运行时在一个面板中加载



i创建了我希望通过执行此操作来绑定其数据的报告

Dim oRpt As new ucReport



i created a data set manually and created a datatable pricelist. The reportviewr is in a usercontrol ucReport, which is loaded inside a panel at run tyime

i have created the report i want to bound its data to by doing this
Dim oRpt As New ucReport

Dim ds As DataSet = GetDataset("prices")
     Dim rds As ReportDataSource = New ReportDataSource("ReportDataSet", ds.Tables(0))
                With oRpt.rvMain.LocalReport
                    .ReportPath = "Reports\pricelist.rdlc"
                    .DataSources.Clear()
                    .DataSources.Add(rds)
                    .Refresh()
                End With







这个getdata来源看起来像






ths getdata source looks like

Private Function GetDataset(ByVal sName As String) As DataSet

        Dim conn As New SQLiteConnection("Data Source=" & dbPath)
        conn.Open()
        Dim sql As String = Nothing
        Select Case sName.ToLower
            Case "prices"
                sql = "Select * FROM prices_view"
        End Select

        Dim ad As SQLiteDataAdapter = New SQLiteDataAdapter(sql, conn)
        Dim ds As DataSet = New DataSet
        ad.Fill(ds)
        Return ds
   End Function





当我运行报告时,我在报告查看器中没有得到任何内容



When i run the report, i don''t get anything in the report viewer

推荐答案

您可以参考MSDN博客 http://blogs.msdn.com/b/magreer/archive/2008/10/16/setting-the-datasource-for-a- report-at-runtime.aspx [ ^ ]
You can refer MSDN blog http://blogs.msdn.com/b/magreer/archive/2008/10/16/setting-the-datasource-for-a-report-at-runtime.aspx[^]


这篇关于将手动创建的数据集绑定到vb.net 2.0报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆