Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi
there is a error in
Add(CI)



MyDatabaseEntities dc = new MyDatabaseEntities();
try
{
dc.Empmodeles.Add(CI);
dc.SaveChanges();

message = "Successfully Saved!";
}

finally
{
dc.Dispose();
}


Error:'object' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

help me thanks.

What I have tried:

i dont know what shoul i do


help me
Posted
Updated 4-Feb-20 0:54am
Comments
F-ES Sitecore 4-Feb-20 6:24am    
What type is "dc.Empmodeles"?
Richard MacCutchan 4-Feb-20 6:25am    
"I dont know what shoul i do"
Look at the error message; your Empmodeles class does not contain an Add method.

1 solution

Look at the defintion of your MyDatabaseEntities class, and see what type the Empmodeles property returns. I'm guessing it returns an generic object rather than a specific user or system collection datatype. If so, then you need to cast the property return to the appropriate class in order to use the Add method.
If not, then you need to look at the class type it does return and work out why it either doesn't contain an Add method, or why you think it should!

Sorry, but we can't do any of that for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900