on 04-25-2009 1:51 PM
Dear All,
I am using CR X1 RDC report viewer. When I click on the Refresh button in the report viewer, the crystal report getting updated with the latest data base values. I have tried to refresh the crystal report through code by using the Refresh() function in the m_Viewer. But it is not working. The code snippet i have given below for your reference.
CCrystalReportViewer11 m_Viewer;
IApplicationPtr m_Application;
IReportPtr m_ReportType;
m_ReportType = m_Application->OpenReport(FilePath);
GroupName = (_bstr_t)csGroupName;
m_ReportType->FormulaFields->GetItemByName("GroupName")->Text = GroupName;
/* To hide the Preview section */
m_Viewer.SetEnableGroupTree(0);
/* To hide the Border */
m_Viewer.SetDisplayBorder(0);
/* To hide the Preview Tab*/
m_Viewer.SetDisplayTabs(0);
m_Viewer.SetReportSource(m_ReportType);
m_Viewer.Refresh();
m_Viewer.ViewReport();
m_Viewer.Refresh();
Please suggest me to make it work.
Regards,
Rahaneef T
Try discardSavedData(?). Or, doing the same thing in the CR designer; go to the File menu and ensure there is no checkmark next to Save data with report.
Now, not having a db logon, depending on the database, you may get a db logon error as the code is now...
Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahaneef,
Once the object and data is in memory refresh will use that info each time. It's basically a report with saved data so to refresh the data you need to use m_ReportType.DiscardSavedData in your loop before the refresh called the second time. This also re-runs the report.
Thank you
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.