Skip to Content
avatar image
Former Member

Problem with refreshing crystalreport 2010, shows the same data

Hi

I am having a problem with refreshing a crystalreport version 2010 used in visualstudio 2010

I created a DLL where a pass some values and in dll i create the objecto ReportDocument

I load the report and pass it a query to load new data but it shows the old data, the report is saved with Save data to report unchecked.

What's wrong, why report doesn't load new data?

there is part of my code that use

Private ReporteCR As New CrystalDecisions.CrystalReports.Engine.ReportDocument

ReporteCR.Load(PathReporte)

ReporteCR.Refresh()

odt = Serv.TraerDataTable(strsql)

' solo necesita user/pwd para evitar ventana de logon

ReporteCR.SetDatabaseLogon(sUsuario, sPwd) ' , sServidor, sBD

' ''Dim savedata As Boolean

' ''savedata = ReporteCR.ReportOptions.EnableSaveDataWithReport

ReporteCR.ReportOptions.EnableSaveDataWithReport = False

ReporteCR.ReportOptions.EnableUseDummyData = False

' '' '' '' ''ReporteCR.ReportOptions.EnableSaveSummariesWithReport = False

' ''If savedata = False And ReporteCR.HasSavedData = True Then

' '' ReporteCR.Refresh()

' '' ReporteCR.VerifyDatabase()

' ''End If

' ''ReporteCR.VerifyDatabase()

' Pasa los datos al reporte

ReporteCR.SetDataSource(odt)

' Asigna objeto crystal a reportviewer

CrystalReportViewer1.ReportSource = ReporteCR

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 15, 2012 at 10:46 PM

    Hello,

    After you set location the do a refresh just before the viewer.

    Are you hitting the Viewers Refresh button?

    Don

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 15, 2012 at 10:51 PM

    It looks like you are using DataTable and setting the DataSource to use the datatable.

    The datatable access the data stored in-memory cache of data retrieved from a data source.

    Even if you try to refresh the the crystal report it's going the bring the same that that has been brought by Datatable/DataSet earlier.

    This could be a good read:

    http://msdn.microsoft.com/en-us/library/system.data.dataset(v=vs.71).aspx

    - Saurabh

    Add comment
    10|10000 characters needed characters exceeded