We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to add DataSources programmatically while preventing the user adding own DataSources

Would be great to know if you can provide a sample with a local business object data source.

6 Replies

AS Anandakumar S Syncfusion Team January 28, 2014 12:44 PM UTC

Hi Patrick,

Thanks for using Syncfusion Products.

We have prepared a sample for using local business object data source in ReportDesigner and it can be download from the following location.

Report sample: http://www.syncfusion.com/downloads/support/directtrac/118474/PreviewRDCL-6178121861707774314.zip

Please let us know if you have any questions.

Regards,

Anandakumar S



PC Patrick Crucq January 30, 2014 06:27 AM UTC

Yeah, but is there a possibility to add the DataSet programmatically directly when the users starts the Report Designer to prevent the user to deal with more technical details?


AS Anandakumar S Syncfusion Team January 31, 2014 10:03 AM UTC

Hi Patrick,


Thanks for your update.


ReportDesigner have AddDataSet , AddDataSource API’s for adding DataSource/DataSet to the Report from an existing ReportDefinition. You can use these API’s in ReportOpened / NewReportOpened event of ReportDesigner. Please find code snippet for this below.


AddDataSet/AddDataSource:


void ReportDesignerControl_NewReportOpened(object sender, ReportChangedEventArgs e)

{

this.ReportDesignerControl.AddDataSet("Path to the existing report", "DataSetName");

this.ReportDesignerControl.AddDataSource("Path to the existing report", "DataSourceName");

}


Please let us know if you have any questions.


Regards,

Anandakumar S



AS Anandakumar S Syncfusion Team January 31, 2014 10:03 AM UTC

Hi Patrick,


Thanks for your update.


ReportDesigner have AddDataSet , AddDataSource API’s for adding DataSource/DataSet to the Report from an existing ReportDefinition. You can use these API’s in ReportOpened / NewReportOpened event of ReportDesigner. Please find code snippet for this below.


AddDataSet/AddDataSource:


void ReportDesignerControl_NewReportOpened(object sender, ReportChangedEventArgs e)

{

this.ReportDesignerControl.AddDataSet("Path to the existing report", "DataSetName");

this.ReportDesignerControl.AddDataSource("Path to the existing report", "DataSourceName");

}


Please let us know if you have any questions.


Regards,

Anandakumar S



SA System Administrator April 9, 2014 04:14 PM UTC

Is there any way to add the data set/store without sourcing it from another report file? Our data may change dynamically so need a way to set the stores in code. I assume the only way at the moment would be to mock a fake report with data set in XML and write it to a stream to pass to AddReport?


AS Anandakumar S Syncfusion Team May 19, 2014 03:26 PM UTC

Hi LEO LI,

 

We can also add DataSource /DataSet at runtime by modifying the ReportDefinition and we can load  it to the ReportDesigner. We have prepared a sample to modify the ReportDefintion dynamically, it can be downloaded from the following location.

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/116065/ReportCustomization1938392844.zip

 

Please let us know if you have any questions.

 

Regards,

Anandakumar S


Loader.
Live Chat Icon For mobile
Up arrow icon