Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/01/2015, 15:50
ricardo7m
 
Fecha de Ingreso: enero-2015
Mensajes: 1
Antigüedad: 9 años, 3 meses
Puntos: 0
Pregunta Como desplegar información en un textbox

Hola a todos, apenas estoy empezando a programar en asp.net en C# y tengo unos problemas, espero me puedan ayudar.

Estoy utilizando un store procedure para poder buscar el id de un usario y que por medio de este me despligue informacion en unos textbox, mi procedimiento almacenado es este:
ALTER PROCEDURE stp_department_showItem
@id int
WITH ENCRYPTION
AS
BEGIN
SET NOCOUNT ON
select department_id AS "departmentId"
, name
, [description]
, [status]
from Department
WHERE department_id = @id
END
GO

Funciona perfectamente, mi problema viene al momento de querer desplegar en unos text box, así es como lo estoy intentando hacer, como aun no se como desplegar no estoy 100% seguro de que funcione, si tengo algo incorrecto me gustaría que me lo hicieran saber:

public partial class Department : System.Web.UI.Page
{
String sql_con;
SqlConnection Cnx;

protected void Page_Load(object sender, EventArgs e)
{
sql_con = ConfigurationManager.ConnectionStrings["cnd"].ConnectionString;
Cnx = new SqlConnection(sql_con);

if (!IsPostBack)
{
var id = Request.QueryString["id"];

if (id == null)
{
Response.Write("New USer");


}
else
{
Response.Write("User Information");
hdnId.Value = id;
SqlCommand cmd = new SqlCommand();
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet Dsh = new DataSet();
SqlParameter param;
SqlDataReader reader = cmd.ExecuteReader();
cmd.Connection = Cnx;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "stp_department_showItem";
param = new SqlParameter("@id",id);
param.Direction = ParameterDirection.Input;
param.SqlDbType = SqlDbType.Int;
cmd.Parameters.Add(param);
adapter = new SqlDataAdapter(cmd);
adapter.Fill(Dsh);
Cnx.Open();
// cmd.ExecuteNonQuery();

Cnx.Close();


}
}
}

Les agradecería mucho cualquier ayuda que me puedan brindar, gracias.