Sets or gets the data source object that provides data to the report.

Namespace:  C1.C1Report
Assembly:  C1.C1Report.2 (in C1.C1Report.2.dll)

Syntax

C#
[BrowsableAttribute(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public Object Recordset { get; set; }
Visual Basic
<BrowsableAttribute(False)> _
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)> _
Public Property Recordset As Object
	Get
	Set

Remarks

Usually, the control creates a DataTable object based on the value of the ConnectionString and RecordSource properties, and uses that object as the report data source.

Alternatively, you may want to create the data source object yourself, and assign it to the control. You can do that by assigning your data source object to the Recordset property.

When a DataTable or DataView object is assigned to the Recordset property, C1Report automatically creates an internal wrapper class that implements the IC1ReportRecordset interface. Because of this, you can't get the original DataTable or DataView objects back by reading the property value. Instead, you must cast the wrapper object to an IListSource and use the GetList()()()() method instead, as shown in the example below.

Field Value

You can assign objects of the following types to the Recordset property: (1) DataTable objects, (2) DataView objects, or (3) any object that implements the IC1ReportRecordset interface.

Examples

Copy CodeC#
// create a DataTable
DataTable dt = new DataTable("my table");

// assign it to c1report
// automatically creates IC1ReportRecordset wrapper
c1r.DataSource.Recordset = dt;

// 1) this doesn't work (dbBad == null)
object wrapper = c1Report1.DataSource.Recordset;
DataTable dtBad = wrapper as DataTable;

// 2) this does (dtGood == dt)
DataView dv = ((IListSource)wrapper).GetList() as DataView;
DataTable dtGood = dv.Table;

See Also