ComponentOne provides two reporting tools namely ActiveReports 7 and C1Report . These components give developers and the end users similar flexibility to connect reports to various data sources. One data source that has been garnering a lot of attention has been the XSD or the Typed Dataset.aspx). This blog article sums up the steps that developers would need to connect C1Report and ActiveReports 7 to a Typed Dataset. The first step that is common to both the reporting components relates to Creating a Typed DataSet or the XSD file that needs to be used as a Datasource for the report. Now that you have Typed Dataset ready, let’s go through the steps on How to Connect ActiveReports 7 and C1 Report to a Typed Dataset (XSD)
private void Report_ReportStart(object sender, EventArgs e)
{
NWINDDataSetTableAdapters.ProductsTableAdapter da = new XSD_dataSource.NWINDDataSetTableAdapters.ProductsTableAdapter();
da.Fill(nwindDataSet1.Products);
}
Use code provided below to Load the Report XML and Set the Recordset Property of the C1Report to the Typed dataset referenced in Step 6 and view the report in C1PrintPreviewControl.
public void LoadC1Reports()
{
// load report definition (before setting the data source)
c1Report1.Load(GetFilePath("Report.xml"), "Products Report");
// Set the XSD DataSource
c1Report1.DataSource.ConnectionString = GetFilePath("NWINDDataSet.xsd");
// Fill the dataset
NWINDDataSetTableAdapters.ProductsTableAdapter da = new XSD_dataSource.NWINDDataSetTableAdapters.ProductsTableAdapter();
da.Fill(nwindDataSet1.Products);
c1Report1.DataSource.Recordset = nwindDataSet1.Products;
c1PrintPreviewControl1.Document = c1Report1;
}
Download the attached samples for complete implementation. Download C# Sample Download VB.NET Sample