using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AlfredoLotar.Livro.Aspnet.SchoolModel;

public partial class ExecuteStoreCommand : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnExecutar_Click(object sender, EventArgs e)
    {
        using (SchoolEntities contexto = new SchoolEntities())
        {
            int i = contexto.ExecuteStoreCommand("insert Person values ({0}, {1}, {2}, {3})",
                            "Lotar", "Alfredo", "12/09/2012", "12/09/2010");
            Response.Write("Linhas afetadas: " + i);


            GridView1.DataSource = contexto.ExecuteStoreQuery<Person>
                ("Select * from Person order by PersonID DESC");
            GridView1.DataBind();
        }
    }
}