private void Btn_buscar_Click(object sender, RoutedEventArgs e) { ProveedorBLL pb = new ProveedorBLL(); bool id = true; if (txt_id.Text.Trim() == "") { id = false; lbid.Content = "Debe ingresar una id"; } if (id) { int idd = Int32.Parse(txt_id.Text); bool existe = pb.GetProvIdEXISTE(idd); if (existe) { try { DataTable da = pb.GETALLP(idd); DataRow row = da.Rows[0]; txt_nombre.Text = row[1].ToString(); txt_fono.Text = row[2].ToString(); txt_mail.Text = row[3].ToString(); txt_direccion.Text = row[4].ToString(); txt_descripcion.Text = row[5].ToString(); } catch (Exception ex) { MessageBox.Show("" + ex); } } else { lbid.Content = "Esta id no existe en el sistema"; } } else { lbid.Content = "Debe ingresar una id"; } }