Many applications need to work on the data outside of C1Report and load it into DataTable objects. In these cases, you may use these objects as report data sources, avoiding the need to load them again when rendering the report.
This approach is also useful in applications where:
To use a DataTable object as a C1Report data source, simply load the report definition and then assign the DataTable to the C1Report Recordset property. For example:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' load DataTable from cache or from a secure/custom provider Dim dt As DataTable = GetMyDataTable() ' load report definition (before setting the data source) c1r.Load(reportFile, reportName) ' use DataTable as the data source for the C1Report component c1r.DataSource.Recordset = dt |
To write code in C#
C# |
Copy Code
|
---|---|
// load DataTable from cache or from a secure/custom provider DataTable dt = GetMyDataTable(); // load report definition (before setting the data source) c1r.Load(reportFile, reportName); // use DataTable as the data source for the C1Report component c1r.DataSource.Recordset = dt; |