Skip to Content
avatar image
Former Member

auto refresh crystal reports in visual studio 2010

Hi Guys

I'm developing a simple database application in visual studio 2010. My problem is that after updating the database, the report doesn't always display the new values; for example, after 10 updates I might have to manually press the reset button twice. There's no rhyme or reason to this. Is there any code I can insert so the report automatically refreshes each time it loads up?

Any assistance would be much appreciated

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 28, 2012 at 09:47 AM

    Uncheck the 'Saved data with report' oprion from report.

    Add 'CrReportDocument.Refresh()' just after you load the report.

    - Bhushan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Don Williams

      Hi Don

      I'm using visual studio 2010, but unsure of the CR version

      Basically, I've got a blank form that I've added a crystal report viewer to

      When Im asked to specify a CR for the control, I choose "ReportOne.rpt"

      (UseReportDocument checkbox in ticked)

      Something called "ReportOne1" automatically appears at the bottom of the form.

      I couldn't match your suggested code with the variables I have.

      Any further advice would be much appreciated


  • avatar image
    Former Member
    Mar 30, 2012 at 08:23 AM

    Hi Marcus,

    Please add the following code after when you loaded your report and before showing or printing the data.

    // This clears the cache so report retrieves new data from database            if (reportDocument.HasRecords || reportDocument.HasSavedData)            {                reportDocument.ReportClientDocument.RowsetController.Refresh();            }

    This should clear your current data and allow for retrieving new data.

    With kind regards,

    Pieter Jong

    Crystal Advice

    Add comment
    10|10000 characters needed characters exceeded