GameSchedulingEntities db = new GameSchedulingEntities();
Group obj = new Group();
obj.Name = NametextBox.Text;
db.Groups.Add(obj);
db.SaveChanges();
不,我想更新数据库中的数据。我怎么能这样做..我正在使用Windows窗体
答案 0 :(得分:0)
试试这个
GameSchedulingEntities db = new GameSchedulingEntities();
Group obj = db.Groups.Find(Id);
// or Group obj = db.Groups.FirstOrDefault(g => g.Name == NametextBox.Text);
obj.Name = somethingelse;
db.SaveChanges();