• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

Microsoft Reportviewer changing reports at runtime

I have 2 reports being displayed in a reportviewer. They run ok first time, but when I try to run the second report re using the same reportviewer object I get the following error.

An error occured during local report processing
An error has occured during report processing
A data source instance has not been supplied for the data source "dsForwardLogic_dtSummaryPermit"

Both reports work fine on their own, its only when I try to run the second report I get the error.
First Sub........
     Dim daExtension As New PermitExtensionTableAdapters.PermitExtensionTableAdapter
        daExtension.Connection = myUtility.sqlConn
        Dim dtResults As Data.DataTable = daExtension.GetDataByDomesticExpire(dtDateStart.Value, dtEndDate.Value, "PERMIT-ISSUED", "Residential")
            rvReport.LocalReport.DataSources.Clear()
            Dim ds As New ReportDataSource("PermitExtension_PermitExtension", dtResults)
            rvReport.LocalReport.DataSources.Add(ds)
    
            rvReport.LocalReport.ReportPath = Application.StartupPath & "\Reports\DomesticExpire.rdlc"
            rvReport.ProcessingMode = ProcessingMode.Local
            rvReport.LocalReport.Refresh()
            rvReport.RefreshReport()

Second Sub.....
            Dim daBPLR As New dsForwardLogicTableAdapters.dtSummaryPermitTableAdapter
            daBPLR.Connection = myUtility.sqlConn
            Dim dtResults As Data.DataTable = daBPLR.GetDataSummary(Me.dtDateStart.Value, Me.dtEndDate.Value)

            rvReport.LocalReport.DataSources.Clear()
            Dim ds As New ReportDataSource("dsForwardLogic_dtSummaryPermit", dtResults)
            rvReport.LocalReport.DataSources.Add(ds)
            rvReport.LocalReport.ReportPath = Application.StartupPath & "\Reports\BPLRSummary.rdlc"
            Dim Params(0) As Microsoft.Reporting.WinForms.ReportParameter
            Params(0) = New Microsoft.Reporting.WinForms.ReportParameter("StartDate", dtDateStart.Value.ToString("dd/MM/yyyy"))
            rvReport.LocalReport.SetParameters(Params)

            rvReport.ProcessingMode = ProcessingMode.Local
            rvReport.LocalReport.Refresh()
            rvReport.RefreshReport()

Open in new window

0
mgordon-spi
Asked:
mgordon-spi
  • 3
  • 3
1 Solution
 
Jorge PaulinoIT Pro/DeveloperCommented:
Can you try to remove the rvReport.LocalReport.DataSources.Clear() ?
0
 
mgordon-spiAuthor Commented:
Sorry I tried that and it had no affect.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
But you click on a button to load one report and then you press another button to open another report in the same form?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
mgordon-spiAuthor Commented:
Yes, there are multiple buttons for different reports all to be displayed in the same reportviewer
0
 
mgordon-spiAuthor Commented:
jpaulino today it seems to be working, no idea what the difference was, but I pretty much only made the change you suggested so I will award the points. Thanks for your help.
0
 
Jorge PaulinoIT Pro/DeveloperCommented:
Nice it's working!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now