c# - LINQ saying invalid arguments for insertonsubmit -
c# - LINQ saying invalid arguments for insertonsubmit -
i seem running issue inserting info table in sql server 08r2 using linq in c#. no matter i've tried maintain getting error insertonsubmit()
. here code...
private void testupdateunitbc() { using (unitdatacontext unit = new unitdatacontext()) { unitnotest unitbc = new unitnotest(); unit.fbarco = "1234"; unit.funitno = "1234"; unit.fjobno = "i9999-0000"; unit.fboxno = "999"; unit.fopno = "999"; unit.unitbcs.insertonsubmit(unitbc); <--this error };
the error reads
void table.insertonsubmit(unitbc entity) adds entity in pending insert state system.data.linq.table. error: best overloaded method match 'system.data.linq.table.insertonsubmit(as5553.unitbc)' has invalid arguments
the container used hold variables matches table datatypes. (string
varchar(64)
) know need unit.submitchanges();
next doesn't matter can't passed insertonsubmit()
point. help great i've tried several things , spent entire day working on research.
update
here unitnotest class requested...
public class unitnotest { public string fbarco {get;set;} public string funitno {get;set;} public string fjobno {get;set;} public string fboxno {get;set;} public string fopno {get;set;} }
it seems entityobject
of type unitnotest
different entityobject
of objectset
of type unitbcs
.
means trying insert wrong object.
c# linq linq-to-sql invalid-argument insertonsubmit
Comments
Post a Comment