Datatable dt = dataSet.Table[0];
DataView dv = new DataView(dt);dv.RowFilter = "key1 = 1";
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;

解决方案 »

  1.   

    再加句
    dv.Sort = "key2 DESC";
      

  2.   

    dataSet.Table[0].Select("key1=1","key2")
    然后通过遍例自己处理重复的数据
      

  3.   

    strExpr = "id > 5"
        ' Sort descending by CompanyName column.
        strSort = "name DESC"
        ' Use the Select method to find all rows matching the filter.
        Dim foundRows As DataRow() = _
            customerTable.Select( strExpr, strSort, DataViewRowState.Added )
      

  4.   

    这个代码你试试看:
    private static DataTable GetDataTableByFilter( DataTable sourceDataTable )
    {
        
        DataTable filteredTable = new DataTable( "Filtered" );
        // Add columns
        filteredTable.Columns.Add( "Key1", typeof(string) );
        filteredTable.Columns.Add( "Key2", typeof(string) );
        filteredTable.Columns.Add( "Value", typeof(string) );    // Set PrimaryKey
        filteredTable.Columns[ "Key2" ].Unique = true;
        filteredTable.PrimaryKey = new DataColumn[] { filteredTable.Columns["Key2"] };    string strExpr;
        string strSort;
        
        strExpr = "Key1 = 1";
        // Sort descending by one column named.
        strSort = "Key2 DESC";
        // Use the Select method to find all rows matching the filter.
        filteredDataTable.Rows = 
            sourceDataTable.Select( strExpr, strSort, DataViewRowState.Added );
        return filteredDataTable;
    }
      

  5.   

    Sorry,重复数据还得通过循环来判断。如果像上述那样的话会抛出异常的。
      

  6.   

    用dataview,
    然后dv.RowFilter = "Key1 = 1";
        dv.Sort = "Key2";
      

  7.   

    Ke2 不重复,你需要遍历过滤排序后的数据.拷贝一份不重复的数据到另一个DataTable,