I am new to entity frame work
when trying to insert data to Database
iam gettin error "'System.Data.Objects.ObjectSet' does not contain a definition for 'Add' and no extension method 'Add' accepting a first argument of type 'System.Data.Objects.ObjectSet' 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
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vincent Maverick DuranoPosted May 17, 2016, 11:16 AM
ali tuncerPosted May 17, 2016, 12:45 AM
are you sure it is Departements?
by default, it should be departments..
prabhu pPosted May 16, 2016, 4:52 AM
ali tuncerPosted May 15, 2016, 10:25 PM
try this way :