/// <summary>
/// 修改操作
/// </summary>
public static void f4()
{
using (nCovDBEntities1 db = new nCovDBEntities1())
{
tbStu tbStu = db.tbStu.Find("201817380415");
tbStu.stuName = "媳妇";
db.SaveChanges();
Console.WriteLine("修改完成");
}
}
/// <summary>
/// 修改操作
/// </summary>
public static void f5(tbStu tbStu)
{
using (nCovDBEntities1 db = new nCovDBEntities1())
{
db.Entry(tbStu).State = EntityState.Modified;
db.SaveChanges();
Console.WriteLine("修改完成");
}
}
EF数据模拟修改
最新推荐文章于 2024-04-01 20:45:35 发布