简体   繁体   中英

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. 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'

I realize that the dataset1 has to be filled, however I cannot figure out how to fill dataset1. I have researched the topic cand came with the following links:

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

http://msdn.microsoft.com/en-us/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.

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!

Do I need to set a new sqlconnection?? Why do I need to do this? Why can I not just use the sqlconnection string that my tableadapter is using??

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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