protected void ButtonIDMySql_Click(object sender, EventArgs e) { ClsBuscarMySQL bs = new ClsBuscarMySQL(); string id = TextBoxIDMySql.Text.Trim(); string condicion = $"correlativo = {id}"; DataTable dt = bs.CargardatosDB(condicion); if (dt.Rows.Count > 0) { string nombre = dt.Rows[0].Field <String>("nombre"); TextBoxResultadoMySql.Text = nombre; } else { TextBoxResultadoMySql.Text = "No hay Información"; } }
protected void ButtonBuscarporNombreMySql_Click(object sender, EventArgs e) { ClsBuscarMySQL bs = new ClsBuscarMySQL(); string nombre = TextBoxNombreMySql.Text.Trim(); string condicion = $"nombre like ('%{nombre}%')"; DataTable dt = bs.CargardatosDB(condicion); if (dt.Rows.Count > 0) { int id = dt.Rows[0].Field <Int32>("correlativo"); TextBoxResultadoMySql.Text = id + ""; } else { TextBoxResultadoMySql.Text = "No hay Información"; } }