using System;
using System.Data;
using AlfredoLotar.Livro.Aspnet.SchoolModel;
using System.Data.Common;
using System.Data.Objects;

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

    }
    protected void bntExecutar_Click(object sender, EventArgs e)
    {
        using (SchoolEntities contexto = new SchoolEntities())
        {
            try{
                ObjectQuery<DbDataRecord> consulta = contexto.Course.Select("it.CourseID, it.Title");
                
                foreach (DbDataRecord reg in consulta)
                {
                    Response.Write(reg["CourseID"].ToString() + ": ");
                    Response.Write(reg["Title"].ToString() + "<p/>");
                }
            }
            catch (EntitySqlException ex)
            {
               Console.WriteLine(ex.ToString());
            }
        }
    }
}