In our app we have a form to edit reports. Our customer often edit reports with lots of data, so when a customer edits a report, we open the report with an empty dataset (schema). When the customer goes to the preview we retrieve the actual data, but after replacing the reports datasource, we notice the datasource is being shown twice in the Field List. Could you explain why this happens and offer a fix/workaround?
Attached a sample application and screenshot to illustrate the problem .
Steps to reproduce:
- run sample application
- click button to open report
- go to preview of the report
- confirm the prompt to refresh to data for the preview
- return to the design-view and notice there are two datasets in the Field List
It is necessary to delete the old report's data source from the designer host to resolve this issue. Here is a corresponding code snippet:
IDesignerHost host = (IDesignerHost)xrDesignPanel1.GetService(typeof(IDesignerHost)); host.Container.Remove((DataSet)xrDesignPanel1.Report.DataSource); // Update designer (the preview-report is merely a copy) xrDesignPanel1.Report.DataSource = this.previewDataSet;