我一直在研究如何使用 LINQ 更新现有记录,但我没有任何运气。这是我创建的方法 - 智能感知不喜欢db.SubmitChanges()
.
public void updateRestaurant(int RestID, int HoursID, string Web, string Desc)
{
RestaurantsEntities db = new RestaurantsEntities();
RESTAURANT restDetails = (from RESTAURANT in db.RESTAURANTs
where RESTAURANT.REST_ID == RestID
select RESTAURANT).Single();
restDetails.HOURS_ID = HoursID;
restDetails.REST_WEBSITE = Web;
restDetails.REST_DESC = Desc;
db.SubmitChanges();
}