日期:2014-05-20  浏览次数:20722 次

脑子想烂。。实在没办法了。。排序的问题
string TypeMovie = "";
  for (int i = 0; i < chk__Type_Movie.Items.Count; i++)
  {
  if (chk__Type_Movie.Items[i].Selected)
  {
  TypeMovie += chk__Type_Movie.Items[i].Text + ".";
  }
  }
  var queryBuilder = QueryBuilder.Create<tb_Movie>()
  .Like(c => c.Name_CN, tb_name.Text.Trim())
  .OrLike(c => c.Name_EN, tb_name.Text.Trim())
  .OrLike(c => c.Url_IMDB, tb_name.Text.Trim())
  .Like(c => c.Year_Movie, tb_Year_Movie.Text)
  .Like(c => c.Path_Save, tb_Path_Save.Text.Trim())
  .Like(c => c.Type_Movie, TypeMovie.ToString());

  imdbDataContext imdb = new imdbDataContext();
  var query = imdb.tb_Movie.Where(queryBuilder.Expression);
  // this.GridView1.DataSource = query.OrderByDescending();
  this.GridView1.DataSource=query;
  this.GridView1.DataBind();

这个排序到底该怎么写 !按照ID_Movie排序

------解决方案--------------------
//this.GridView1.DataSource=query.OrderBy(o=>o.ID_Movie);
 this.GridView1.DataSource=query.OrderByDescending(movie=>movie.ID_Movie);
this.GridView1.DataBind();