Question ReportViewerControl - Not updating report

HeroTheCat

New member
Joined
Dec 19, 2008
Messages
2
Programming Experience
3-5
I have a WinForm application with several report viewer controls and some do not experience this problem, but it has happened before.

I create my reports as RDL files and then copy/rename to an RDLC.
I then add it as a resource for my application.
The application runs, and the report is fine.

Now I edit the RDL file to add parameters or grouping.
I remove the reference to the original RDLC and delete the file.
I again copy/rename the RDL to an RDLC.
When I run the application, the report does NOT show my changes.

I've done a CLEAN, a REBUILD, deleted all files in the bin/Release and Debug folders.

I just don't understand why the reports are not showing my changes.

Any help would be appreciated!!!!
 
Resolved

I found that my ASSUMPTIONS were wrong... LOL


I create a SQL Dataset/Command and ASSUMED that the parameters for that command are "linked" to the report when the Dataset is linked. THIS IS NOT TRUE.

I therefore had to apply the parameters to the report manually as in ....
VB.NET:
    Private Sub renderReport(ByVal conn As SqlConnection, ByVal command As SqlCommand, ByVal reportName As String, ByVal reportViewer As ReportViewer)

        Dim reportDataSet As New DataSet
        Dim reportDataAdapter As New SqlDataAdapter

        Try
            ' create a parameter array to hold the report parameters
            Dim parameters(command.Parameters.Count - 1) As ReportParameter

            ' apply the command to the dataset
            reportDataAdapter.SelectCommand = command

            ' open the connection
            conn.Open()

            ' fill the dataset
            reportDataAdapter.Fill(reportDataSet, "payerMixCharges")

            ' close the connection
            conn.Close()

            ' create the datasource
            Dim rDS As New ReportDataSource("payerMixCharges", reportDataSet.Tables(0))

            lastExecutionPoint = 2900

            ' build the parameter collection
            For i = 0 To command.Parameters.Count - 1
                parameters(i) = New ReportParameter(Replace(command.Parameters(i).ParameterName, "@", ""), command.Parameters(i).Value.ToString)
            Next

            With reportViewer
                .Reset()
                .LocalReport.DataSources.Clear()
                .ProcessingMode = ProcessingMode.Local
                .LocalReport.ReportEmbeddedResource = reportName
                .LocalReport.DataSources.Add(rDS)

                ' APPLY THE COMMAND PARAMS TO THE REPORT
                .LocalReport.SetParameters(parameters)
                .RefreshReport()
                .Refresh()
            End With

        Catch ex As Exception
            MsgBox(ex.InnerException.ToString, MsgBoxStyle.Critical, ex.Message)
        Finally
            reportDataSet = Nothing
            reportDataAdapter = Nothing
        End Try

    End Sub
 
Back
Top