日期:2014-05-20 浏览次数:20682 次
var supplie = db.tb_supplies.Where(s => s.oid == id).SingleOrDefault(); if (supplie!=null) { supplie.otop = top; supplie.oleft = left; db.SubmitChanges(); return "success!"; } 为什么执行之后数据库的值没有改变。
var supplie = db.tb_supplies.Where(s => s.oid == id).SingleOrDefault(); if (supplie!=null) { supplie.otop = top; supplie.oleft = left; [color=#FF0000]db.tb_supplies.InsertOnSubmit(supplie);[/color] db.SubmitChanges(); return "success!"; }
------解决方案--------------------
解决就好
代码还有简化的空间:
var supplie = db.tb_supplies.SingleOrDefault(s => s.oid == id);