ReportViewer Control in WinForm not showing edits.

  • I KNOW THIS IS MORE OF A VB.NET / VISUAL STUDIO QUESTION, BUT I'M HOPING SOMEONE HAS ENCOUNTERED THIS BEFORE....

    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 also do a .Reset() and a .RefreshReport() in my code, to no avail. On a similar note, I do have a report that when changed via the UI I've built, it does not change the report's header as it should. but this is a side problem, that I'll tackle once this one is figured out.

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

    Any help would be appreciated!!!!

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • 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 ....

    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

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply