Hello everyone, I'm having problems with a listing.
I have a DataGridView loading a list of products automatically and a combobox with the names of the categories, the idea is that when selecting a category and clicking the list button, DataGridView loads only the products from that list. I created a query, I ran separately and it works, the problem is, how do I pass the text of the combobox as a parameter at the time of calling the query?
should be something like this, but it gives error
private void btListar_Click(object sender, EventArgs e)
{
string sCategoria = cbCategoriaProduto.Text;
this.tabelaEstoqueTableAdapter.FillByCategoria(
this.baseDadosInfoMasterDataSet.TabelaEstoque, sCategoria);
}
I was able to pass the parameter, I was doing wrong, the correct one was:
this.tabelaEstoqueTableAdapter.FillByCategoria(
this.baseDadosInfoMasterDataSet.TabelaEstoque,
"%" + cbCategoriaProduto.Text + "%");
But it does not show any data in the datagridview: /