stuInfo user; using (snzkDataEntities db = new snzkDataEntities()) { //var xx=Request.Form["x"].ToString(); string idcard = "51090219960829264x"; user = db.stuInfo.SingleOrDefault(x => x.idCard == idcard); if (user != null) { user = model; user.areaCode = Request.Form["x"].ToString(); db.SaveChanges(); TempData["updateMsg"] = "提交成功"; } else { TempData["updateMsg"] = "提交失败"; } } return View(user);
这里的SaveChanges不知道怎么回事不会向数据库提交数据,但是也不会报错。求解!
慕后森
繁华开满天机