当我使用以下代码时,会发生错误
testtelContext db = new testtelContext();
var qry = (from p in db.firstlasts
join i in db.firstnames
on p.Idfname equals i.Idfname
select new
{
id = p.idfl,
name = i.fname
}).ToList();
bindingSource3.DataSource = qry;
dataGridView5.DataSource = bindingSource3;
bindingSource3.AddNew();
使用 bindingSource3.AddNew() 时出错;
错误:无法在 '<>f__AnonymousType1 2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' type. This type does not have a public default constructor. You can call AddNew on the '<>f__AnonymousType1
2[[System.Int32,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089],[System.String,mscorlib,Version=4.0.0.0,Culture =neutral, PublicKeyToken=b77a5c561934e089]]' 如果您设置 AllowNew=true 并处理AddingNew 事件,请输入。