简体   繁体   English

在Visual Studio 2010中的vb.net中创建rdlc报表钻取

[英]creating a drill through rdlc report in vb.net in Visual studio 2010

I have a parent and child report that I created in visual studio 2010 using winforms in vb.net. 我有一个父母报告,该报告是我在Visual Studio 2010中使用vb.net中的winforms创建的。 I have setup one text box in the parent report to go to the child report with the respective value as the paramter. 我在父报表中设置了一个文本框,以将各自的值作为参数转到子报表。 However, when I click on the link I get the error: a data source instance has not been supplied for the data source 'dataset1' 但是,当我单击链接时出现错误:没有为数据源“ dataset1”提供数据源实例

I realize that the dataset1 has to be filled, however I cannot figure out how to fill dataset1. 我意识到必须填充数据集1,但是我无法弄清楚如何填充数据集1。 I have researched the topic cand came with the following links: 我研究了cand主题,并带有以下链接:

http://www.developerfusion.com/t/vb.net/ http://www.developerfusion.com/t/vb.net/

http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer.drillthrough.aspx http://msdn.microsoft.com/zh-cn/library/microsoft.reporting.winforms.reportviewer.drillthrough.aspx

On the winform where the reportviewer controller is located, I have the report drill through handler, but I do not understand how to set the dataset. 在reportviewer控制器所在的winform上,我具有报表钻取处理程序,但是我不了解如何设置数据集。

I have the following, and I am stuck on how to move on: 我有以下内容,但我坚持如何继续前进:

Private Sub ReportViewer1_Drillthrough(ByVal sender As System.Object, ByVal e As Microsoft.Reporting.WinForms.DrillthroughEventArgs) Handles ReportViewer1.Drillthrough

Dim localreport = e.Report
Me.Sp_get_testaccountsTableAdapter1.Fill(Me.Retreival.sp_get_testaccounts)

Dim od As New RetreivalTableAdapters.sp_get_testaccountsTableAdapter


End Sub

As you can see, I am filling the table adapter that dataset 1 is supposed to be connected to, but the dataset1 is still not filling... Please help! 如您所见,我正在填充应该连接数据集1的表适配器,但是dataset1仍然没有填充...请帮助!

Do I need to set a new sqlconnection?? 我需要设置一个新的sqlconnection吗? Why do I need to do this? 为什么我需要这样做? Why can I not just use the sqlconnection string that my tableadapter is using?? 为什么不能只使用tableadapter使用的sqlconnection字符串?

Thank you for your help!! 谢谢您的帮助!!

Based upon the example you provided (the second link), the code for accomplishing what you want to do is as follows: 根据您提供的示例(第二个链接),用于完成您想要执行的操作的代码如下:

void DemoDrillthroughEventHandler(object sender, 
    DrillthroughEventArgs e)
{
    LocalReport localReport = (LocalReport)e.Report;
    localReport.DataSources.Add(new ReportDataSource("Employees",
        LoadEmployeesData()));
}

This shows how to assign a new DataSource based upon the drill-through functionality. 这显示了如何根据追溯功能分配新的数据源。 Just follow the example on the website you gave and you will be fine. 只要按照您提供的网站上的示例进行操作,就可以了。

As for why you need to do it, you have to load new data based upon the user drilling into your data. 至于为什么需要这样做,则必须根据用户对数据的钻取来加载新数据。

Your question about filling the table adapter that the dataset is connected to seems a bit confusing. 您关于填充数据集所连接的表适配器的问题似乎有点令人困惑。 A dataset holds a set of tables. 数据集包含一组表。 The DataSource for your report uses one table out of a dataset. 报表的数据源使用数据集中的一个表。 Therefore, it looks like you might be trying to work backwards (filling a table to fill a dataset). 因此,您似乎正在尝试向后工作(填充表格以填充数据集)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM