当前位置: 代码迷 >> Windows Mobile >> wp7 数据库更新操作,该怎么解决
  详细解决方案

wp7 数据库更新操作,该怎么解决

热度:64   发布时间:2016-04-25 07:44:35.0
wp7 数据库更新操作
请问 wp7 进行某一行的更新的时候 有哪些方法呢。
在网上查到
  public bool UpdateData(MyTable source, MyTable dest)
  {
  try
  {
  var tables = from item in this.Items where (int)item.Index == source.Index select item;

  foreach (MyTable mt in tables)
  {
  mt.Name = dest.Name;
  mt.Age = dest.Age;
  mt.Gen = dest.Gen;
  break;
  }

  MyTable table = _DB.Rows.GetOriginalEntityState(source);
  table.Name = dest.Name;
  table.Age = dest.Age;
  table.Gen = dest.Gen;
  _DB.SubmitChanges();
  }
  catch (Exception e)
  {
  return false;
  }

  return true;
  }

但是我认为

  foreach (MyTable mt in tables)
  {
  mt.Name = dest.Name;
  mt.Age = dest.Age;
  mt.Gen = dest.Gen;
  break;
  }
这段代码是没有用的

------解决方案--------------------
没看明白这代码怎么做到更新的。

你可以看一下mvvm
  相关解决方案