Show / Hide Table of Contents

Class TableDataSource

Represents a datasource based on DataTable class.

Inheritance
System.Object
Base
DataComponentBase
Column
DataSourceBase
TableDataSource
JsonTableDataSource
Implements
IFRSerializable
IParent
Inherited Members
DataSourceBase.currentRow
DataSourceBase.Load
DataSourceBase.RowCount
DataSourceBase.HasMoreRows
DataSourceBase.CurrentRow
DataSourceBase.CurrentRowNo
DataSourceBase.Item[String]
DataSourceBase.Item[Column]
DataSourceBase.ForceLoadData
DataSourceBase.DataType
DataSourceBase.BindableControl
DataSourceBase.CustomBindableControl
DataSourceBase.Format
DataSourceBase.Expression
DataSourceBase.Calculated
DataSourceBase.GetValue(String)
DataSourceBase.Init()
DataSourceBase.Init(String)
DataSourceBase.Init(String, SortCollection)
DataSourceBase.Init(DataSourceBase)
DataSourceBase.Init(DataSourceBase, String, SortCollection)
DataSourceBase.Init(Relation, String, SortCollection)
DataSourceBase.EnsureInit()
DataSourceBase.First()
DataSourceBase.Next()
DataSourceBase.Prior()
DataSourceBase.Deserialize(FRReader)
Column.PropName
Column.PropDescriptor
Column.Columns
Column.SetName(String)
Column.GetExpressions()
Column.GetChildOrder(Base)
Column.SetChildOrder(Base, Int32)
Column.UpdateLayout(Single, Single)
DataComponentBase.Alias
DataComponentBase.Enabled
DataComponentBase.ReferenceName
DataComponentBase.Reference
DataComponentBase.IsAliased
DataComponentBase.Assign(Base)
Base.Name
Base.Restrictions
Base.Flags
Base.Parent
Base.BaseName
Base.ClassName
Base.Report
Base.Page
Base.ChildObjects
Base.AllObjects
Base.ZOrder
Base.IsAncestor
Base.IsDesigning
Base.IsPrinting
Base.IsRunning
Base.OriginalComponent
Base.SetProp(Base, Base)
Base.FloatDiff(Single, Single)
Base.DeserializeSubItems(FRReader)
Base.ExtractDefaultMacros(String)
Base.SetFlags(Flags, Boolean)
Base.SetReport(Report)
Base.SetParentCore(Base)
Base.FindObject(String)
Base.CreateUniqueName()
Base.Clear()
Base.BaseAssign(Base)
Base.AssignAll(Base)
Base.HasParent(Base)
Base.HasFlag(Flags)
Base.HasRestriction(Restrictions)
Base.InvokeEvent(String, Object)
Base.OnAfterLoad()
Base.GetCustomScript()
Base.ExtractMacros()
Base.IsHaveToConvert(Object)
Base.GetConvertedObjects()
Base.ForEachAllConvectedObjects(Object)
Namespace: FastReport.Data
Assembly: FastReport.OpenSource.dll
Syntax
public class TableDataSource : DataSourceBase, IFRSerializable, IParent
Examples

This example shows how to add a new table to the existing connection:

Report report1;
DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
TableDataSource table = new TableDataSource();
table.TableName = "Employees";
table.Name = "Table1";
conn.Tables.Add(table);

Constructors

TableDataSource()

Initializes a new instance of the TableDataSource class with default settings.

Declaration
public TableDataSource()

Properties

Connection

Gets or sets the parent DataConnectionBase object.

Declaration
public DataConnectionBase Connection { get; set; }
Property Value
Type Description
DataConnectionBase

Parameters

Gets a collection of parameters used by "select" command.

Declaration
public CommandParameterCollection Parameters { get; set; }
Property Value
Type Description
CommandParameterCollection
Remarks

You must set up this property if the SQL query that you've specified in the SelectCommand property contains parameters.

You can pass a value to the SQL parameter in two ways.

The right way is to define a report parameter. You can do this in the "Data" window. Once you have defined the parameter, you can use it to pass a value to the SQL parameter. To do this, set the SQL parameter's Expression property to the report parameter's name (so it will look like [myReportParam]). To pass a value to the report parameter from your application, use the SetParameterValue(String, Object) method.

The other way (unrecommended) is to find a datasource object and set its parameter from a code:

TableDataSource ds = report.GetDataSource("My DataSource Name") as TableDataSource;
ds.Parameters[0].Value = 10;
This way is not good because you hardcode the report object's name.

QbSchema

Gets or sets the query builder schema.

Declaration
public string QbSchema { get; set; }
Property Value
Type Description
System.String
Remarks

This property is for internal use only.

SelectCommand

Gets or sets SQL "select" command.

Declaration
public string SelectCommand { get; set; }
Property Value
Type Description
System.String
Remarks

If this command contains parameters, you should specify them in the Parameters property.

StoreData

Gets or sets a value that determines whether it is necessary to store table data in a report file.

Declaration
public bool StoreData { get; set; }
Property Value
Type Description
System.Boolean

Table

Gets or sets the underlying DataTable object.

Declaration
public DataTable Table { get; set; }
Property Value
Type Description
DataTable

TableData

Gets or sets the table data.

Declaration
public string TableData { get; set; }
Property Value
Type Description
System.String
Remarks

This property is for internal use only.

TableName

Gets or sets the table name.

Declaration
public string TableName { get; set; }
Property Value
Type Description
System.String

Methods

AddChild(Base)

Adds a child object to this object's childs.

Declaration
public override void AddChild(Base child)
Parameters
Type Name Description
Base child

Object to add.

Overrides
Column.AddChild(Base)

CanContain(Base)

Gets a value indicating that this object can contain the specified child object.

Declaration
public override bool CanContain(Base child)
Parameters
Type Name Description
Base child

Child object.

Returns
Type Description
System.Boolean

true if this object can contain the specified child object; otherwise, false.

Overrides
Column.CanContain(Base)

Dispose(Boolean)

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
Overrides
Base.Dispose(Boolean)

GetChildObjects(ObjectCollection)

Gets a list of child objects.

Declaration
public override void GetChildObjects(ObjectCollection list)
Parameters
Type Name Description
ObjectCollection list

List to fill with values.

Overrides
Column.GetChildObjects(ObjectCollection)

GetValue(Column)

Gets data stored in a specified column.

Declaration
protected override object GetValue(Column column)
Parameters
Type Name Description
Column column

The column.

Returns
Type Description
System.Object

An object that contains the data.

Overrides
DataSourceBase.GetValue(Column)

InitializeComponent()

Initializes the object before running a report.

Declaration
public override void InitializeComponent()
Overrides
DataSourceBase.InitializeComponent()
Remarks

This method is used by the report engine, do not call it directly.

InitSchema()

Initializes the datasource schema.

Declaration
public override void InitSchema()
Overrides
DataSourceBase.InitSchema()
Remarks

This method is used to support the FastReport.Net infrastructure. Do not call it directly.

LoadData(ArrayList)

Loads the datasource with data.

Declaration
public override void LoadData(ArrayList rows)
Parameters
Type Name Description
System.Collections.ArrayList rows

Rows to fill with data.

Overrides
DataSourceBase.LoadData(ArrayList)
Remarks

This method is used to support the FastReport.Net infrastructure. Do not call it directly.

RefreshTable()

Refresh the table schema.

Declaration
public void RefreshTable()

RemoveChild(Base)

Removes a specified object from this object's childs.

Declaration
public override void RemoveChild(Base child)
Parameters
Type Name Description
Base child
Overrides
Column.RemoveChild(Base)

Serialize(FRWriter)

Serializes the object.

Declaration
public override void Serialize(FRWriter writer)
Parameters
Type Name Description
FRWriter writer

Writer object.

Overrides
DataSourceBase.Serialize(FRWriter)
Remarks

Do not call this method directly. You should override it if you are developing a new component for FastReport.

This method is called when the object needs to save the state. It may happen when:

  • saving the report to the file or stream;
  • saving the report to the designer's undo buffer;
  • assigning the object to another object using the Assign(Base) or AssignAll(Base) methods;
  • saving the object to the designer's clipboard;
  • saving the object to the preview (when run a report).

SetParent(Base)

Sets the object's parent.

Declaration
public override void SetParent(Base value)
Parameters
Type Name Description
Base value

New parent.

Overrides
Base.SetParent(Base)
Remarks

This method is for internal use only. You can use it if you are developing a new component for FastReport. Override it to perform some actions when the parent of an object is changing. This method checks that parent can contain a child.

Exceptions
Type Condition
ParentException

Parent object cannot contain this object.

Implements

IFRSerializable
IParent
Back to top Generated by DocFX