C# sql linq lamda写法

在数据库Customer中查询id>1的所有信息

1.Lamda表达式:

var data = dbContext.Customer.Where(u=>u.Id>1);

            foreach (var item in data)

            {

                Console.WriteLine(item.Id+" " +item.CusName);

            }

2.SQL写法:

select * from Customer where id > 1;

3.Linq写法:

from Customer where id>1 select *;

猜你喜欢

转载自blog.csdn.net/xoofly/article/details/84317416