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

mgordon-spiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jorge PaulinoIT Pro/DeveloperCommented:
Can you try to remove the rvReport.LocalReport.DataSources.Clear() ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.