on 03-28-2012 4:01 AM
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
Uncheck the 'Saved data with report' oprion from report.
Add 'CrReportDocument.Refresh()' just after you load the report.
- Bhushan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Marcus
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
http://www.crystaladvice.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcus,
Add these assemblies to your Project:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.CommonControls;
using CrystalDecisions.ReportAppServer.CommLayer;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.DataSetConversion;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Windows.Forms;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
Then you can use RAS.
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
When you load the report then you can assign the Report to the ReportClientDoc:
rptClientDoc = rpt.ReportClientDocument;
Don
Just to add a tiny bit of help. I find the article How to Use The RAS SDK .NET With In-Process RAS Server very useful.
And of course the Dev help, etc.
- Ludek
Hi Don
I went to Project Properties, and added about 20 references of the format CrystalDecisions.Reportxxxx
But I'm still unsure of where to insert the USING statements (and whatever else I need to declare) to make Pieter's simple code work:
Marcus
Really?
Very first line of your main form...
Maybe you should start off with these samples:
http://wiki.sdn.sap.com/wiki/display/BOBJ/Crystal+Reports+for+.NET+SDK+Samples
Most connect to BOE so simply ignore that part and just load your report.
Don
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.