asp.net LINQ数据访问技术from where select order by子句


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
var value = from v in values
where v < 3 || v > 7
orderby v descending
select v;
Response.Write("查询结果:<br>");
foreach (var i in value)
{
Response.Write(i + "<br>");
}
}
}

 

在LINO查询表达式中,orderby 升序用ascending关键字,降序用descending关键字

 

posted @ 2016-12-18 13:02  清风白水  阅读(737)  评论(0编辑  收藏  举报