1
Hello guys I’m facing 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 will only load the products from that list. I created a query, ran it separately and it works, the problem is, how to pass the combobox text as parameter when calling the query?
it should be something like this, but it makes a mistake
private void btListar_Click(object sender, EventArgs e)
{
string sCategoria = cbCategoriaProduto.Text;
this.tabelaEstoqueTableAdapter.FillByCategoria(
this.baseDadosInfoMasterDataSet.TabelaEstoque, sCategoria);
}
I managed to pass the parameter, I was doing wrong, the correct was:
this.tabelaEstoqueTableAdapter.FillByCategoria(
this.baseDadosInfoMasterDataSet.TabelaEstoque,
"%" + cbCategoriaProduto.Text + "%");
But it shows no data in datagridview :/
Do not put the solution in the body of the question, publish a new answer with the solution.
– ptkato