标签:style blog http java color 使用
这是“windows phone mango本地数据库(sqlce)”系列短片文章的最后一篇第十四篇。 为了让你开始在Windows Phone Mango中使用数据库,这一系列短片文章将覆盖所有你需要知道的知识点。我将谈谈在windows phone mango本地数据库里怎么删除数据。

DataContext如下所示:
 1 public class CountryDataContext : DataContext
 2  {
 3      public CountryDataContext(string connectionString)
 4          : base(connectionString)
 5      {
 6      }
 7    
 8      public Table<Country> Countries
 9      {
10          get
11          {
12              return this.GetTable<Country>();
13          }
14      }
15    
16      public Table<City> Cities
17      {
18          get
19          {
20              return this.GetTable<City>();
21          }
22      }
23  }
 1 private void DeleteCity()
 2  {
 3      using (CountryDataContext context = new CountryDataContext(ConnectionString))
 4      {
 5          // find a city to delete
 6          IQueryable<City> cityQuery = from c in context.Cities where c.Name == "Madrid" select c;
 7          City cityToDelete = cityQuery.FirstOrDefault();
 8            
 9          // delete city from the context
10          context.Cities.DeleteOnSubmit(cityToDelete);
11    
12          // save changes to the database
13          context.SubmitChanges();
14      }
15  }
这篇文章我谈论了在windows phone mango本地数据库删除数据。希望你能喜欢它们并找到有用的东西。
Windows Phone本地数据库(SQLCE):14、删除数据(翻译),布布扣,bubuko.com
Windows Phone本地数据库(SQLCE):14、删除数据(翻译)
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/zgqys1980/p/3838296.html