Results 1 to 2 of 2

Thread: Report Viewer Control - Report not showing edits?

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    2

    Thumbs down Report Viewer Control - Report not showing edits?

    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 in a 2nd solution and then copy/rename to an RDLC in the project resources directory.
    I then add it as a resource for my application.
    The application runs, and the report is fine.

    Now I edit the RDL file in the 2nd solution to add parameters or grouping.
    I remove the reference to the original RDLC and delete the file.
    I again copy/rename the RDL to the 1st solution's directory as an RDLC.
    I re-add the referrence to the RDLC file.
    When I run (Debug or Release) 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!!!!

  2. #2

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    2

    RESOLVED: Report Viewer Control - Report not showing edits?

    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 ....
    Code:
        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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width