0
I’m with a ComboBox
that when I select Active or Inactive status it empties my DataGrid
What I’d like him to do is select one of the two Options and bring all records with Active Status, for an example
code that I’m using :
private void comboBox1_SelectedValueChanged_1(object sender, EventArgs e)
{
string strSelect = "SELECT * FROM Produto WHERE status LIKE (@status)";
using (MySqlConnection conn = new MySqlConnection("server=127.0.0.1;database=ProdPacote; Uid=root; pwd=1234;"))
{
MySqlDataAdapter da = new MySqlDataAdapter(strSelect, conn);
//Passagem por parâmetros.
da.SelectCommand.Parameters.AddWithValue("@status", comboBox1.SelectedValue);
DataSet ds = new DataSet();
da.Fill(ds, "status");
dataGridView1.DataSource = ds.Tables["status"];
}
}