下一段代码中是否有办法只获得第一条记录?

Dal.TreeHtmlExportsCollection treeHtmlExportsCollection =
  new Dal.TreeHtmlExportsCollection().Where(Dal.TreeHtmlExports.Columns.TreeId, treeId).
  OrderByDesc(Dal.TreeHtmlExports.Columns.DateCreated).Load();

最佳答案

您可以使用查询工具来做到这一点,例如:(需要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>();

希望能有所帮助!

关于subsonic - SubSonic系列前1名,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/306051/

10-11 08:39