DataView.Sort 属性

获取或设置 DataView 的一个或多个排序列以及排序顺序。

**命名空间:**System.Data
**程序集:**System.Data(在 system.data.dll 中)

语法

声明
Public Property Sort As String
用法
Dim instance As DataView
Dim value As String

value = instance.Sort

instance.Sort = value
public string Sort { get; set; }
public:
property String^ Sort {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_Sort ()

/** @property */
public void set_Sort (String value)
public function get Sort () : String

public function set Sort (value : String)

属性值

一个字符串,它包含列名,后跟“ASC”(升序)或“DESC”(降序)。在默认情况下列按升序排序。多个列可用逗号隔开。

备注

有关更多信息,请参见 创建和使用 DataView

示例

下面的示例指示 DataView 按照两列对表进行排序。

Private Sub SortByTwoColumns()
    ' Get the DefaultViewManager of a DataTable.
    Dim view As DataView = DataTable1.DefaultView

    ' By default, the first column sorted ascending.
    view.Sort = "State, ZipCode DESC"
End Sub
private void SortByTwoColumns()
{
    // Get the DefaultViewManager of a DataTable.
    DataView view = DataTable1.DefaultView;

    // By default, the first column sorted ascending.
    view.Sort = "State, ZipCode DESC";
}

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

DataView 类
DataView 成员
System.Data 命名空间
DataView.RowFilter 属性
DataColumn.Expression 属性