4
Answers

how to fix this error

prabhu p

prabhu p

8y
328
1
I am new to entity frame work 
when  trying to insert data to  Database 
 
 
iam gettin  error "'System.Data.Objects.ObjectSet<Entityframeworkinsertupdelete.Departement>' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Data.Objects.ObjectSet<Entityframeworkinsertupdelete.Departement>' could be found (are you missing a using directive or an assembly reference?)" 
 
protected void Button1_Click(object sender, EventArgs e)
{
welcometestingEntities context = new welcometestingEntities();
department obj = new department();
obj._name = TextBox1.Text;
obj._location = TextBox2.Text;
 
context.Departements.Add(obj); //error on this line
//--- Bind data to repeater.
bindStudentInfo();
//--- Show confirmation message in label.
//--- Clear text from textboxes
}
 
please help me
 
thanks 
 
 
 
 
Answers (4)