using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strconexao = @"server=.\SQLExpress;database=NorthWind;Integrated Security=SSPI";
        using (SqlConnection conn = new SqlConnection(strconexao))
        {
            SqlCommand cmd = new SqlCommand("storedProcedure", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader r = null;
            try
            {
                conn.Open();
                r = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                int idCliente = r.GetOrdinal("CategoryID");
                if (r.HasRows)
                    while (r.Read())
                    {
                        if (!r.IsDBNull(idCliente))
                            Response.Write(r.GetInt32(idCliente) + "<br/>");
                    }
            }
            finally
            {
                if (r != null) r.Close();
            }
        }
    }
}

