日期:2014-05-20  浏览次数:20817 次

LINQ增加一条数据,报错,求解决
Error 1 The type arguments for method 'System.Data.Linq.Table<DAL.Person>.InsertAllOnSubmit<TSubEntity>(System.Collections.Generic.IEnumerable<TSubEntity>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
C# code
LinqDBDataContext db = new LinqDBDataContext(LinqSystem.constring);
            Model.Person person = new Model.Person();
            person.Id = Id;
            person.Name = name;
            db.Persons.InsertAllOnSubmit(person);
            db.SubmitChanges();


------解决方案--------------------
LinqDBDataContext db = new LinqDBDataContext(LinqSystem.constring);
db.Persons person = new db.Persons();
person.Id = Id;
person.Name = name;
db.Persons.InsertOnSubmit(person);
db.SubmitChanges();
------解决方案--------------------
探讨
Error 1 The type arguments for method 'System.Data.Linq.Table<DAL.Person>.InsertAllOnSubmit<TSubEntity>(System.Collections.Generic.IEnumerable<TSubEntity>)' cannot be inferred from the usage. Try spec……