Title: EntityFramework Select, Insert, Update, Delete                                 If you need copy same format use firefox or chrome or safari but iexplorer not work


Preview of Code
    private DemoEntities db = new DemoEntities();
 
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = db.personMains;// select * from Personmains
        GridView1.DataBind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = db.personMains.Where(em => em.ID ==1);
        GridView1.DataBind();
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        personMain pm = new personMain();
        pm.Name = TextBox1.Text;
        db.AddTopersonMains(pm);//add object of personmain to db
        db.SaveChanges(); // db save changes
 
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        int IDs = Convert.ToInt32(TextBox1.Text);
        personMain pmt = db.personMains.Where(em => em.ID == IDs).First();
        db.DeleteObject(pmt);
        db.SaveChanges();
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        int IDS = Convert.ToInt32(TextBox1.Text);
        personMain pmt = db.personMains.Where(emt => emt.ID == IDS).First();
        pmt.Name = TextBox2.Text;
        db.SaveChanges();
    }