namespace Regext.operaciones
{
class grillas
{
MySqlDataReader dr = null;
public void llenargrillaclienteempresa(DataGridView grilla_empresa, Bunifu.Framework.UI.BunifuMaterialTextbox txt_buscar_empresa)
{
MySqlCommand cmd = new MySqlCommand("select * from tb_empresa where rut_empresa = '" + txt_buscar_empresa.Text + "'", con);
con.Open();
try
{
dr = cmd.ExecuteReader();
if(dr.Read() == true){
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
grilla_empresa.DataSource = dt;
}else{
MessageBox.Show("no se encontro rut");
}
}
catch (Exception f)
{
MessageBox.Show("error");
}
finally
{
con.Close();
}
}
}
}
I have this class that serves to fill in the grids but the reader does not read that does not enter the first if but if deference if the rut is in the database or not.