I have a form with the following fields, the problem is that I can not find what is wrong because it does not block the textbox of the first button and those that are in the second button if it blocks them, it is supposed to do the same thing for In addition, the data is the same in the two sections.
protected void btncomprobar2_Click(object sender, EventArgs e)
{
if (txtnom.Text != "")
{
cmd = new SqlCommand("select d_direccion,d_edad,d_ciudad from Personal where d_nombres='" + txtnom.Text + "'", conn);
conn.Open();
try
{
dr = cmd.ExecuteReader();
if (dr.Read() == true)
{
lblmensaje.Text = "";
txtdir.Enabled = true;
txtedad.Enabled = true;
txtciud.Enabled = true;
txtdir.Text = dr["d_direccion"].ToString();
txtedad.Text = dr["d_edad"].ToString();
txtciud.Text = dr["d_ciudad"].ToString();
}
else
{
lblmensaje.Text = "Nombre invalido";
}
}
finally
{
conn.Close();
}
}
protected void btncomprobar_Click(object sender, EventArgs e){
if (txtnom.Text != "")
{
cmd = new SqlCommand("select d_direccion,d_edad,d_ciudad from Personal where d_nombres='" + txtnom.Text + "'", conn);
conn.Open();
try
{
dr = cmd.ExecuteReader();
if (dr.Read() == true)
{
lblmensaje.Text = "";
txtdir.Enabled = true;
txtedad.Enabled = true;
txtciud.Enabled = true;
txtdir.Text = dr["d_direccion"].ToString();
txtedad.Text = dr["d_edad"].ToString();
txtciud.Text = dr["d_ciudad"].ToString();
}
else
{
lblmensaje.Text = "Nombre invalido";
}
}
finally
{
conn.Close();
}
}