日期:2014-05-20  浏览次数:20715 次

linq Northwind数据
最近在看linq查询的知识,可是看到一个例子:
main

     NORTHWNDEntites n = new NORTHWNDEntites();
    var quer = from c in n.Customers where c.Country == "USA"
    select new{ID = c.CustomerId,City = c.City,State = c.Rogion}
};
要怎么才可以使这个类得到数据呢?
Northwind linq

------解决方案--------------------
在文件-新建项-Linq to Sql类
然后找到数据库把表导入,起名叫NORTHWNDEntites。系统会为你生成DataContext类。

之后再写这代码就好使了。