如何排序多个列-Linq到SQL

如何排序多个列-Linq到SQL,linq,linq-to-sql,Linq,Linq To Sql,想通过x.IRNumber-,然后通过x.BED LOCATION,但是运气不好,有人能帮我找到正确的方向吗 谢谢 标记 字符串jobID=ddlJobID.SelectedValue using (rw_forms context = new rw_forms()) { var result = from c in context.hospedia_running_sheet_view.Select(x => new

想通过x.IRNumber-,然后通过x.BED LOCATION,但是运气不好,有人能帮我找到正确的方向吗

谢谢

标记

字符串jobID=ddlJobID.SelectedValue

        using (rw_forms context = new rw_forms())
        {
            var result = from c in context.hospedia_running_sheet_view.Select(x => new
            {
                x.uniqueID,
                x.irNumber,
                x.ward,
                x.bed_location,
                x.bed_extension,
                x.select_technology,
                x.select_fitting_of_pattress,
                x.select_fitting_of_backplate,
                x.fixing_method_used,
                x.id,
                x.status,
                x.latitude,
                x.longitude,
                x.accuracy,
                x.createdAt,
                x.createdByName,
                x.fixing,
                x.statusID,
                x.commissioningID,
                x.jobID,
                x.siteName
            }).Where(x=> x.statusID == 1).Where(x => x.jobID == ((jobID == "-1") ? x.jobID : jobID)).OrderByDescending(x => x.irNumber) select c;

            grdForms.DataSource = result.ToList();
            grdForms.DataBind();
        }
    }
    catch(Exception ex)
    {
        Response.Write(ex.ToString());
    }
}

如果你想要这样的东西

SELECT * FROM TEST
ORDER BY TEST.ID,TEST.RID DESC
-


运气不好对你没什么帮助。当你尝试它时,它会做什么。我假设您正在尝试
.OrderByDescending(x=>x.irNumber)。然后by(x=>x.BedLocation)
您好,抱歉是没有帮助,是的,这是我得到的回报,如上所述,CS1061:“AnonymousType#1”不包含“BedLocation”的定义,并且找不到接受“AnonymousType#1”类型的第一个参数的扩展方法“BedLocation”(您是否缺少using指令或程序集引用?)。看起来您应该使用
x.bed_location
而不是
x.BedLocation
from t in db.TEST 
orderby t.ID, t.RID descending 
select t