如何在 linq to sql 中执行 Select All(*) [英] How to do Select All(*) in linq to sql
本文介绍了如何在 linq to sql 中执行 Select All(*)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在做 linq to sql 时如何选择所有行?
How do you select all rows when doing linq to sql?
Select * From TableA
请使用查询语法和方法语法.
In both query syntax and method syntax please.
推荐答案
from row in TableA select row
或者只是:
TableA
在方法语法中,使用其他运算符:
In method syntax, with other operators:
TableA.Where(row => row.IsInteresting) // no .Select(), returns the whole row.
本质上,您已经选择了所有列,然后选择将其转换为您关心的列,因此您甚至可以执行以下操作:
Essentially, you already are selecting all columns, the select then transforms that to the columns you care about, so you can even do things like:
from user in Users select user.LastName+", "+user.FirstName
这篇关于如何在 linq to sql 中执行 Select All(*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文