# Data Sources

Get started with FlexReport, a WinForms control, which is a fast-paced reporting engine that enables you to create, preview, export and print modern and dynamic reports for all your applications. See more in documentation here.

## Content

A FlexReport definition can include several data sources, which are accessible through [C1FlexReport.DataSources ]()collection. The data sources in this collection are identified by unique names. These data sources can be used as:

* **Main data source**: It is the main data source for a report. The main data source is specified by using [C1FlexReport.DataSourceName](/componentone/docs/wpf/online-flexreport/) property on the report. If the main data source is not specified (**DataSourceName** is empty or contains a name not found in the DataSources collection), C1FlexReport is rendered in unbound mode, containing a single instance of the Detail section.
* **Data source for Parameters**: It is the source of valid values for the report parameters (elements in the [C1FlexReport.Parameters](/componentone/docs/wpf/online-flexreport/) collection). The data source for parameters is specified using **ReportParameter.AllowedValuesDefinition.Binding.DataSourceName** property.
* **Data source for Charts**: It is the data source for the Chart field. The data source for charts is specified using **ChartField.DataSource** property.

The list of supported data source types in FlexReport are as follows:

* OLE DB
* ODBC
* XML
* Object in external assembly
* Microsoft SQL Server Compact Data Provider version 3.5 and 4.0

For backwards compatibility with C1Report, [C1FlexReport](/componentone/api/wpf/online-flexreport/dotnet-framework-api/C1.WPF.FlexReport.4.6.2/C1.WPF.FlexReport.C1FlexReport.html) has a [DataSource](/componentone/docs/wpf/online-flexreport/) property which points to DataSources [DataSourceName]. When a new **C1FlexReport** is created, a single element with the name 'Main' is added to its **C1FlexReport.DataSources** collection, and 'Main' is assigned to the [C1FlexReport.DataSourceName](/componentone/docs/wpf/online-flexreport/) property.

Note that in C1Report, Main data source is the only data source for the report.

## Binding Data to Parameters in Multiple Data Source Report

Binding data to parameters defines the valid values for the report parameters (elements in the [C1FlexReport.Parameters](/componentone/docs/wpf/online-flexreport/) collection). The **ReportParameter.AllowedValuesDefinition.Binding.DataSourceName** property indicates the data source which is used to build the list of possible values in the parameters. The following code illustrates how to bind data to the parameters in a report with multiple data sources.

```vbnet
' add datasource and parameter using this datasource
Dim mds As DataSource = rep.DataSource
Dim ds As New DataSource()
ds.Name = "CategoriesDS"
ds.ConnectionString = mds.ConnectionString
ds.RecordSource = "select * from categories"
ds.DataProvider = DataProvider.OLEDB
rep.DataSources.Add(ds)
mds.RecordSource = "select * from products where categoryid = [CategoryParam]"
Dim rp As New ReportParameter()
rp.DataType = Doc.ParameterType.[Integer]
rp.Prompt = "Category"
rp.Name = "CategoryParam"
rp.AllowedValuesDefinition.Binding.DataSourceName = "CategoriesDS"
rp.AllowedValuesDefinition.Binding.ValueExpression = "CategoryID"
rp.AllowedValuesDefinition.Binding.LabelExpression = "CategoryName"
rep.Parameters.Add(rp)
```

```csharp
// add datasource and parameter using this datasource
DataSource mds = rep.DataSource;
DataSource ds = new DataSource();
ds.Name = "CategoriesDS";
ds.ConnectionString = mds.ConnectionString;
ds.RecordSource = "select * from categories";
ds.DataProvider = DataProvider.OLEDB;
rep.DataSources.Add(ds);
mds.RecordSource = "select * from products where categoryid = [CategoryParam]";
ReportParameter rp = new ReportParameter();
rp.DataType = Doc.ParameterType.Integer;
rp.Prompt = "Category";
rp.Name = "CategoryParam";
rp.AllowedValuesDefinition.Binding.DataSourceName = "CategoriesDS";
rp.AllowedValuesDefinition.Binding.ValueExpression = "CategoryID";
rp.AllowedValuesDefinition.Binding.LabelExpression = "CategoryName";
rep.Parameters.Add(rp);
```