none
Refreshed ReportViewer (RDLC) RRS feed

  • Question

  • gud day,

    i am having problems with refreshed reportviewer in winforms. at first the reportviewer displays the right data, but after opening the reportviewer through a click event the data was not being refreshed and displays the previous data. below is my line of code on how do i generate my reports. plssssss help me guys

               // TODO: This line of code loads data into the 'reportDataset.StirrupsView' table. You can move, or remove it, as needed.
                this.stirrupsViewTableAdapter.Fill(this.reportDataset.StirrupsView);
                // TODO: This line of code loads data into the 'reportDataset.ColumnView' table. You can move, or remove it, as needed.
                this.columnViewTableAdapter.Fill(this.reportDataset.ColumnView);
                // TODO: This line of code loads data into the 'reportDataset.ColumnView' table. You can move, or remove it, as needed.
                ReportParameter[] parameter = new ReportParameter[1];
                parameter[0] = new ReportParameter("Report_ProjectName", projectName);
    
                this.reportViewer1.LocalReport.SetParameters(parameter);
                this.reportViewer1.RefreshReport();

    • Moved by Harry Zhu Wednesday, January 20, 2010 5:59 AM I'm moving the thread relating to report controls (From:Visual C# General)
    Saturday, January 16, 2010 4:38 PM

Answers

  • No. You still need to load the data when the Form is loaded, but you also need to reload the data every time the report is refreshed (and yes, in the ReportRefresh event). The ReportViewer relies on the host application to supply the data (new/old). It doesn't perform any data processing on its own. This is another way of saying that you need to make sure that new data is supplied to the ReportViewer.

    Based on your latest question, I think you need to duplicate the TableAdapterFill methods in your ReportRefresh event handler to solve your problem.


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Monday, March 1, 2010 4:27 PM
    Moderator

All replies

  • are there any help, comments, suggestions regarding my problem in reportviewer??? i badly need your help guys.:(
    Sunday, January 24, 2010 10:49 PM
  • Try with

    this.reportDataset.Clear() before Fill method of the table adapter.
    Monday, January 25, 2010 12:47 PM
  • @zaro i have tried what you have said. this is my code
                this.reportDataset.Clear();
                // TODO: This line of code loads data into the 'reportDataset.StirrupsView' table. You can move, or remove it, as needed.
                this.stirrupsViewTableAdapter.Fill(this.reportDataset.StirrupsView);
                // TODO: This line of code loads data into the 'reportDataset.ColumnView' table. You can move, or remove it, as needed.
                this.columnViewTableAdapter.Fill(this.reportDataset.ColumnView);
                ReportParameter[] parameter = new ReportParameter[1];
                parameter[0] = new ReportParameter("Report_ProjectName", ProjectName);
                this.reportViewer1.LocalReport.SetParameters(parameter);
                this.reportViewer1.RefreshReport();

    but the above code still doesnt work. i have work around using the reportDataset.Clear() and .Dispose() in other events like FormClosing(); but still my reportviewer shows the previous data and didn't show the newly set of data's. i badly need your help guys... :(
    Monday, January 25, 2010 2:42 PM
  • If you are only supplying new data but using the same report definition, you may need to call ReportViewer.LocalReport.Refresh().

    For larger changes to the report snapshot, call ReportViewer.Reset(), though note that this will require that you resupply the report definition.

    Monday, January 25, 2010 5:25 PM
    Moderator
  • i do have tried to use LocalReport.Refresh(); but still the data's are the same... are there still any method that i can use in order to fix my problem??

    this is what i did..
         
           this.reportDataset.Clear();
    
                // TODO: This line of code loads data into the 'reportDataset.StirrupsView' table. You can move, or remove it, as needed.
                this.stirrupsViewTableAdapter.Fill(this.reportDataset.StirrupsView);
                // TODO: This line of code loads data into the 'reportDataset.ColumnView' table. You can move, or remove it, as needed.
                this.columnViewTableAdapter.Fill(this.reportDataset.ColumnView);
                ReportParameter[] parameter = new ReportParameter[1];
                parameter[0] = new ReportParameter("Report_ProjectName", ProjectName);
                this.reportViewer1.LocalReport.SetParameters(parameter);
                this.reportViewer1.LocalReport.Refresh();
                this.reportViewer1.RefreshReport();


    • Edited by jihmantiquilla Tuesday, January 26, 2010 1:31 PM change the code
    Tuesday, January 26, 2010 1:25 PM
  • are there any required events that i needed to add (to put the localreport.refresh or the reportviewer.reset methods) in order to  work around my reportviewer.
    Monday, February 1, 2010 1:04 AM
  • Hi Did anyone got the solution. Is the problem with report viewer version 8.0.0.0. 
    Saturday, February 6, 2010 6:00 PM
  • Hi there,

    ReportViewer.Reset() worked for me.

    My situation was a little different.  I was streaming a report definition into the LocalReport with small tweaks after a user postback.  The LocalReport was ignoring my changes.  It seems to be pulling the previous definition from some cache location (viewstate I presume).  Anyway, doing the reset just before I loaded in my new definition stream did the trick.
    Friday, February 19, 2010 6:56 PM
  • Just checking: are you sure that new data is supplied by your table adapter when you refresh your report? Data will always be as new as the last time you retrieved it. The ReportViewer control only uses the data that's supplied to it, and doesn't retrieve the data by itself, so even if you call ReportViewer.RefreshReport(), it will just get the new/old data from the bound datasets.

    If you haven't done it already, you should call the *TableAdapter.Fill() methods in the ReportViewer.ReportRefresh event handler to make sure that new data is retrieved when the report is refreshed.


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, February 23, 2010 4:04 PM
    Moderator
  • are there any required events that i needed to add (to put the localreport.refresh or the reportviewer.reset methods) in order to  work around my reportviewer.

    Just checking: are you sure that new data is supplied by your table adapter when you refresh your report? Data will always be as new as the last time you retrieved it. The ReportViewer control only uses the data that's supplied to it, and doesn't retrieve the data by itself, so even if you call ReportViewer.RefreshReport(), it will just get the new/old data from the bound datasets.

    If you haven't done it already, you should call the *TableAdapter.Fill() methods in the ReportViewer.ReportRefresh event handler to make sure that new data is retrieved when the report is refreshed.


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Tuesday, February 23, 2010 4:04 PM
    Moderator
  • thanks for the replies

    @cephalin

    are you trying to say that i should move my TableAdapterFill methods into Refresh Event of my ReportViewer??
    Monday, March 1, 2010 3:31 AM
  • No. You still need to load the data when the Form is loaded, but you also need to reload the data every time the report is refreshed (and yes, in the ReportRefresh event). The ReportViewer relies on the host application to supply the data (new/old). It doesn't perform any data processing on its own. This is another way of saying that you need to make sure that new data is supplied to the ReportViewer.

    Based on your latest question, I think you need to duplicate the TableAdapterFill methods in your ReportRefresh event handler to solve your problem.


    Cephas Lin This posting is provided "AS IS" with no warranties.
    Monday, March 1, 2010 4:27 PM
    Moderator
  • Hey, I have the exactly this problem too and I am going to mad about the same problem in my C# winform application, did you find any solution if you found one plz suggest me you ll save someone's life :(((((((

     

    looking forward for your positive response

     

    Tuesday, June 15, 2010 6:39 PM
  • @cephalin dear I tried the above suggestion but its not working in my project, I m working on a C# win app VS 2008.
    Tuesday, June 15, 2010 6:42 PM
  • This is not report viewer's problem, actually when use typed dataset in winform app the dataset in not refreshing on runtime even calling on tableadapter fill method. So report viewer in not getting new data to show and this problem occur, It shows old data even after inserting new data to database tables.

    I searched alot to refresh typed dataset data but I could not cater this problem if you guys have any Suggestion please pass it to me so I can resolve my problem.

    I made a business app and its almost complete and my deadline is near :(. I have not enough time to use any other reports because I made almost 20 reports in RDLC and they are working very well with all parameters but only the problem is with refreshing report data on runtime.

     

     

    Wednesday, June 16, 2010 5:43 AM