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;
using System.Web.Configuration;
using System.Configuration;

public partial class StoredProcedures : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            int resultado;
            if (Int32.TryParse(Request.QueryString["id"].ToString(), out resultado))
            {
                ConnectionStringSettings getString = WebConfigurationManager.ConnectionStrings["nwind"] as ConnectionStringSettings;
                if (getString != null)
                {
                    string sSql = "Exibir";
                    using (SqlConnection conn = new SqlConnection(getString.ConnectionString))
                    {
                        SqlCommand cmd = new SqlCommand(sSql, conn);
                        cmd.CommandType = CommandType.StoredProcedure;

                        SqlParameter param = cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int));
                        param.Value = resultado;
                        conn.Open();
                        SqlDataReader r = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                        if (r.HasRows)
                        {
                            while (r.Read())
                            {
                                Label1.Text+=r.GetString(1) + "<br/>";
                            }
                        }
                        r.Close();
                    }
                }
            }
        }
    }
}