下一段代码中是否有办法只获取第一条记录?
Dal.TreeHtmlExportsCollection treeHtmlExportsCollection =
new Dal.TreeHtmlExportsCollection().Where(Dal.TreeHtmlExports.Columns.TreeId, treeId).
OrderByDesc(Dal.TreeHtmlExports.Columns.DateCreated).Load();
答案 0 :(得分:9)
您可以使用查询工具执行此操作:(需要SubSonic 2.1)
var query = new Select()
.Top("1")
.From(TreeHtmlExports.Schema)
.Where(TreeHtmlExports.Columns.TreeId).IsEqualTo(treeId)
.OrderDesc(TreeHtmlExports.Columns.DateCreated);
treeHtmlExportCollection = query.ExecuteAsCollection<TreeHtmlExportsCollection>();
希望有所帮助!