ComponentOne DataObjects for .NET
Sorting Data in Virtual Mode
DataObjects for .NET (Enterprise Edition) > Virtual Mode – Dealing with Large Datasets > Sorting Data in Virtual Mode

DataObjects for .NET supports sorting data in virtual mode, specified either at design (TableView.FillSort) or at run time (FillSort). However, sorting data in virtual mode will only have good performance if corresponding index exists in the database. An index is usually necessary for the database SQL optimizer to produce an efficient execution plan for a statement with ORDER BY.

In the Schema Designer, sort order is specified for a virtual mode table view by setting its FillSort property. If you specify TableView.FillSort for a table view in virtual mode, that sort order must form a unique key (there is no such requirement for table views in static mode). If FillSort does not represent a unique key, a run-time exception will occur when two different row with equal key values are fetched. You can always ensure uniqueness of a sort order by adding primary key fields in the end.

If no TableView.FillSort is specified for a table view in the schema, primary key order is used as the default sort.

It is also possible to specify sort order for a table view at run time. To change sort order of a table view at run time, call C1DataSet.Fill with a filter condition and a list of table view names containing the name of the table view in question. Specify FilterCondition.FillSort for the table view in one of the filter conditions. This FillSort string will override TableView.FillSort specified in the schema. This FillSort string must satisfy the same uniqueness requirement as TableView.FillSort specified in the schema. This FillSort string must satisfy the same uniqueness requirement asFillSort. In DataObjects for .NET Express, use FillSort property to specify sort order. To change sort at run time, set FillSort and call Fill.