5
I created a search screen with a textbox
, one button
and a gridview
.
I would like the search results to appear on this Gridview
but I can only do that with one Dataset
. In this case I needed to find a way to pass parameters through this DataSet
.
Follow the code for evaluation:
protected void btnPesquisar_Click(object sender, EventArgs e)
{
string pesquisa = txtBusca.Text.Trim();
CarrinhoCompraBD bd = new CarrinhoCompraBD();
CarrinhoCompras select = bd.Select(pesquisa);
DataSet ds = new DataSet();
ds = bd.Select(); //Esta linha é onde o visual studio aponda o erro
lblTeste.Text = "Resultado da busca para: " + CarregaResultado(pesquisa) +".";
gvResultado.DataSource = ds.Tables[0].DefaultView; //CarregaResultado(pesquisa);
gvResultado.DataBind();
}
protected string CarregaResultado(string pesquisa)
{
CarrinhoCompraBD bd = new CarrinhoCompraBD();
CarrinhoCompras select = new CarrinhoCompras();
select = bd.Select(pesquisa);
gvResultado.Visible = true;
pesquisa = select.Busca;
return pesquisa;
}
Hello Morrison, all right? Look, sorry it took me so long to answer. So, this is a college job but I had already solved that I just didn’t have time to post here. Your tip to shorten the tbm code worked, I tested later but did not solve the problem because the error was in another class. Still my thanks for the attention Sorry for the bug, I’m beginner in this, a lot to learn yet
– Rafaelqueiroz
Tranquility. In need, we are there.
– Leonel Sanches da Silva