有没有像sql中 order by newid()这么简单的方法?请各位大大帮帮忙!!!

解决方案 »

  1.   

    你在 SQL 语句中,用随机排序不就好了嘛
      

  2.   

    用DataViewDataView  dv=new DataView (dtTable);
    this.MyDataGrid .DataSource =dv;   
    dv.Sort = "ID DESC";
      

  3.   

    dasanhai(合子) 大大 
    你的方法不对
    dv 里 没有ID这一列
      

  4.   

    DataRow[] objDataRowSort = m_objDataSet.Tables[0].Select(null, colName + " DESC");
      

  5.   

    用datatable的dataview属性对象有sort方法
      

  6.   

    liduke(天下有雪) ( ) 大大
    说具体点,那个参数是随即的。我现在搞得好复杂,效果也不好。
      

  7.   

    请各位大大帮帮忙。
    string  mystr1=DateTime.Now.Millisecond.ToString().Substring(1,1);
    int i=Convert.ToInt16(mystr1);
    if (i>3)
    {
    if (i<7) 
    {
    dt.DefaultView.Sort="ID desc";
    DataGrid1.DataSource = dt.DefaultView;
    DataGrid1.DataBind();
    }
    else
    {
    dt.DefaultView.Sort="ID";
    DataGrid1.DataSource = dt.DefaultView;
    DataGrid1.DataBind();
    }
    }

    else
    {

    DataGrid1.DataSource = dt;
    DataGrid1.DataBind();
    }