ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Working with C1Report > Creating, Loading, and Rendering the Report > Loading Report Data > Using Custom Data Source Objects

Using Custom Data Source Objects

You can use custom objects as data sources. The only requirement is that the custom object must implement the IC1ReportRecordset interface.

IC1ReportRecordset is a simple and easy-to-implement interface that can be added easily to virtually any collection of data. This is often more efficient than creating a DataTable object and copying all the data into it. For example, you could use custom data source objects to wrap a file system or custom XML files.

To use a custom data source objects, load the report definition and then assign the object to the C1Report.Recordset property. For example:

      Visual Basic

' get custom data source object

Dim rs As IC1ReportRecordset = CType(GetMyCustomDataSource(), IC1ReportRecordset)

 

' load report definition (before setting the data source)

c1r.Load(reportFile, reportName)

 

' use custom data source object in C1Report component

c1r.DataSource.Recordset = rs

      C#

// get custom data source object

IC1ReportRecordset rs = (IC1ReportRecordset)GetMyCustomDataSource();

 

// load report definition (before setting the data source)

c1r.Load(reportFile, reportName);

 

// use custom data source object in C1Report component

c1r.DataSource.Recordset = rs;


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.