Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member
replied

Ok. Your code should be as follows:


Private ReporteCR As New CrystalDecisions.CrystalReports.Engine.ReportDocument

ReporteCR.Load(PathReporte)

odt = Serv.TraerDataTable(strsql)

ReporteCR.SetDataSource(odt)

CrystalReportViewer1.ReportSource = ReporteCR

If that results in a db logon, it's because the structure of the odt object is not what the report is expecting. E.g.; the schema is different. You can check this out by writing out the odt object into an XML file. Then open the report in the CR designer. Point the report at the xml and see what happens now. My guess is that you will get a field mapping dialog, indicating that there is something in the xml / odt object that the report does not understand.

- Ludek

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question