NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TableSetting Class

Defines the custom settings used to view a DataTable in a DataSetView.

Object
   TableSetting

[Visual Basic]
Public Class TableSetting
[C#]
public class TableSetting
[C++]
public __gc class TableSetting
[JScript]
public class TableSetting

Remarks

A TableSetting is a customized "view" of a DataTable that is used in a DataSetView. The TableSetting allows automatic filtering, sorting, and row state filtering of any table in a DataSet. A DataSet contains a collection of linked DataTable objects, you can view several tables at once, but through the TableSetting feature, each table will have it's own view of a table.

For example, imagine a master/details view of a two tables "Customer" and "Orders") in a relationship. The customers table is set to display only those customers whose names are "Smith." The orders table, on the other hand, shows only the orders (of the customers named "Smith") that have not yet shipped. To accomplish this, add TableSetting objects to the TableSettingsCollection (collection) that belongs to the DataSetView through the TableSettings property. For the first TableSetting object, the RowFilter property would be set to an expression like:

LName = 'Smith'

A second TableSetting object might be created for the Orders table with this RowFilter expression:

"IsNull(ShipDate,'Null Column') = 'Null Column'"

For details on creating expressions for the RowFilter property, see Expression.

Requirements

Namespace: System.Data

Assembly: System.Data.dll

Example [Visual Basic]

The following example creates a DataSetView and adds two TableSetting objects to the TableSettingsCollection.

[Visual Basic]

' The next two lines go into the Declarations section of the module:
Private myDataSetView As DataSetView
' SuppliersProducts is a class derived from DataSet.
Private myDataSet As SuppliersProducts 


Private Sub CreateDataSetView()
   ' Not shown: SuppliersProducts is already configured with tables, relations, constraints.
   myDataSet = New SuppliersProducts
   myDataSetView = New DataSetView(myDataSet)
End Sub

Private Sub AddTableSettings()
   ' Create TableSetting and add it to TableSettingsCollection.
   Dim ts As TableSetting
   ts = New TableSetting(myDataSet.Tables("Suppliers"), "CompanyName", _
   "CompanyName < Z" & Combo1.Text, DataRowState.ModifiedCurrent)
   myDataSetView.TableSettings.Add(ts)

   ' Create and add second TableSetting.
   ts = New TableSetting(myDataSet.Tables("Products"), "ProductName", _
   "Discontinued = 'True'", DataRowState.CurrentRows)
   myDataSetView.TableSettings.Add(ts)
End Sub

See Also

TableSetting Members | System.Data Namespace | DataTable | DataSetView | TableSettingsCollection | RowFilter