MySQL实体框架不保存数据

时间:2018-10-28 16:47:33

标签: mysql asp.net entity-framework linq

我正在使用以下代码将数据保存到MySQL数据库中。

DBEntities odbb = new DBEntities();

test_tba oinst_tba = new test_tba();
oinst_tba.agent_id = agent.Id;
oinst_tba.instruction_id = sCaseId;
oinst_tba.accept = 0;
oinst_tba.sms_id = "";

odbb.test_tba.Add(oinst_tba);
odbb.SaveChanges();

这不是将数据保存到数据库中。

重点:

  • 没有引发错误。
  • 表确实具有主键
  • 如果我在调用SaveChanges之后检查对象,它将显示对象中增加的id
  • 此外,如果我将值保存在数据库中,那么它将在调用SaveChanges()
  • 后保存具有下一个递增ID的对象的数据。

0 个答案:

没有答案
相关问题