ActilceT At = new ActilceT();
At.ActicleContent = "ss";
At.ActilceListT.ActilceListID = 1;//这行报错未将对象引用到实例;ActilceListID是ActilceT表的外键,ActilceListT是主表,
using (E_dbEntities db = new E_dbEntities())
{
db.AddToActilceT(At);
db.SaveChanges();
}
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
At.ActilceListT=new 类型;
At.ActilceListT.ActilceListID = 1;