标签:style blog http java color 使用
这是“windows phone mango本地数据库(sqlce)”系列短片文章的第十一篇。 为了让你开始在Windows Phone Mango中使用数据库,这一系列短片文章将覆盖所有你需要知道的知识点。我将谈谈在windows phone mango本地数据库里怎么使用LINQ查询数据库。
1 private IList<Country> GetCountries()
2 {
3 IList<Country> countryList = null;
4 using (CountryDataContext context = new CountryDataContext(ConnectionString))
5 {
6 IQueryable<Country> query = from c in context.Countries select c;
7 countryList = query.ToList();
8 }
9
10 return countryList;
11 }
示例2:从数据库中选择所有名字以“U”开头的country记录
1 private IList<Country> GetCountriesStartingWithU()
2 {
3 IList<Country> countryList = null;
4 using (CountryDataContext context = new CountryDataContext(ConnectionString))
5 {
6 IQueryable<Country> query =
7 from c in context.Countries
8 where c.Name.StartsWith("U")
9 select c;
10 countryList = query.ToList();
11 }
12
13 return countryList;
14 }
这篇文章我谈论了在windows phone mango使用LINQ查询数据库。请继续关注接下来的文章。
Windows Phone本地数据库(SQLCE):11、使用LINQ查询数据库(翻译) (转),布布扣,bubuko.com
Windows Phone本地数据库(SQLCE):11、使用LINQ查询数据库(翻译) (转)
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/zgqys1980/p/3838286.html