学习

解决方案 »

  1.   

    你可以从 DataSet 的表中提取的 DataView 进行排序,使用 DataView.Sort的属性来排序。
    详细请参考:
    DataView.Sort 属性
    http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfSystemDataDataViewClassSortTopic.asp使用 DataView 对数据排序和筛选
    http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconsortingfilteringdatausingdataview.asp
      

  2.   

    那我搜索时,是不是搜索DATAVIEW呢?
      

  3.   

    ds.Tables[0].DefaultView.Sort="Timetemp asc";//其中Timetemp是你需要排序的字段
    ds.AcceptChanges();
    datagrid1.DataSource=ds;
    datagrid1.DataBind();
      

  4.   

    你可以使用使用 DataView 的 Find 和 FindRows 方法来对行进行搜索。
    请参见:
    搜索 DataView
    http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconSearchingDataView.asp
      

  5.   

    string strSort = "InductionDate ASC";//需要排序的列和顺序
    DataRow[] objDataRowSort = m_dsResultInduction.Tables["InductionMessage"].Select(null, strSort);
    DataTable objNewDataTable = m_dsResultInduction.Tables["InductionMessage"].Clone();
    for (int i = 0; i < objDataRowSort.Length; i++)
    {
    // import row from the original table
    objNewDataTable.ImportRow(objDataRowSort[i]);
    }
    m_dsResultInduction.Tables.Clear();
    // add new table
    m_dsResultInduction.Tables.Add(objNewDataTable);
    // Change datagrid
    m_dsResultInduction.AcceptChanges();
      

  6.   

    看一眼:   http://www.sz3000.com/index.htm?QQ=822982