Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/08/2011, 11:56
anthonysan83
 
Fecha de Ingreso: febrero-2011
Mensajes: 5
Antigüedad: 13 años, 3 meses
Puntos: 0
De acuerdo Respuesta: Mostrar datos de consulta en textbox

Muchas gracias my buen, la verdad me la estaba complicando mucho y pense que era mas dificil, solo le hice unos ajustes al codigo y lo deje asi

Código HTML:
 protected void btnbuscar_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection();
            conn = new SqlConnection(conexion);
            conn.Open();
            string query = "SELECT * FROM empleados WHERE Id = @id";
            SqlCommand cmd = new SqlCommand(query, conn);
            cmd.Parameters.AddWithValue("@id", Convert.ToInt32(txtbusqueda.Text));
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read()) 
            {
                txtid.Text = dr["id"].ToString();
                txtnombre1.Text = dr["first_name"].ToString();
                txtnombre2.Text = dr["middle"].ToString();
                txtapepat.Text = dr["last"].ToString();
                txtapemat.Text = dr["second_last"].ToString();
            }
        }
Te agradesco mucho el tiempo en responder, me ha sido de gran ayuda