有,参考DataTable.Select 方法 
示例[Visual Basic, C#] 以下示例使用筛选表达式和记录状态来返回 DataRow 对象的数组。
[Visual Basic, C#] 注意   此示例显示如何使用 Select 的一个重载版本。有关其他可用示例,请参阅单独的重载主题。[C#] 
private static void GetRowsByFilter()
{
    
    DataTable customerTable = new DataTable( "Customers" );
    // Add columns
    customerTable.Columns.Add( "id", typeof(int) );
    customerTable.Columns.Add( "name", typeof(string) );    // Set PrimaryKey
    customerTable.Columns[ "id" ].Unique = true;
    customerTable.PrimaryKey = new DataColumn[] { customerTable.Columns["id"] };    // Add ten rows
    for( int id=1; id<=10; id++ )
    {
        customerTable.Rows.Add( 
            new object[] { id, string.Format("customer{0}", id) } );
    }
    customerTable.AcceptChanges();    // Add another ten rows
    for( int id=11; id<=20; id++ )
    {
        customerTable.Rows.Add( 
            new object[] { id, string.Format("customer{0}", id) } );
    }    string strExpr;
    string strSort;
    
    strExpr = "id > 5";
    // Sort descending by column named CompanyName.
    strSort = "name DESC";
    // Use the Select method to find all rows matching the filter.
    DataRow[] foundRows = 
        customerTable.Select( strExpr, strSort, DataViewRowState.Added );
    
    PrintRows( foundRows, "filtered rows" );    foundRows = customerTable.Select();
    PrintRows( foundRows, "all rows" );
}private static void PrintRows( DataRow[] rows, string label )
{
    Console.WriteLine( "\n{0}", label );
    if( rows.Length <= 0 )
    {
        Console.WriteLine( "no rows found" );
        return;
    }
    foreach( DataRow r in rows )
    {
        foreach( DataColumn c in r.Table.Columns )
        {
            Console.Write( "\t {0}", r[c] );
        }
        Console.WriteLine();
    }
}

解决方案 »

  1.   

    具体怎么实现不清楚,有个提示:
    DataTable dt = new DataTable("df");
    dt.DefaultView.RowFilter = "column1 = 1";
    .............
      

  2.   

    see(msdn):
    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfSystemDataDataTableClassSelectTopic.htm
      

  3.   

    DataTable.Select 或者 DefaultView.RowFilter 
    查询条件的写法查看帮助文档DataColumn.Expression
      

  4.   

    谢谢楼上;
       DataTable customerTable = new DataTable( "Customers" );
        // Add columns
        customerTable.Columns.Add( "id", typeof(int) );
        customerTable.Columns.Add( "name", typeof(string) );    // Set PrimaryKey
        customerTable.Columns[ "id" ].Unique = true;
        customerTable.PrimaryKey = new DataColumn[] { customerTable.Columns["id"] };    // Add ten rows
        for( int id=1; id<=10; id++ )
        {
            customerTable.Rows.Add( 
                new object[] { id, string.Format("customer{0}", id) } );
        }
        customerTable.AcceptChanges();    // Add another ten rows
        for( int id=11; id<=20; id++ )
        {
            customerTable.Rows.Add( 
                new object[] { id, string.Format("customer{0}", id) } );
        }long fnum;
    //有没有这样函数,得到在表中的第几行
    fnum = DataTable.Find("id = '5'");