0
Good afternoon, you guys. I have a doubt when it comes time to mount a gridview I do not possess much knowledge in c# I did so
string sql = "SELECT pr.codigo_chave,pr.codigo_produto,pr.nome_produto,ca.nome_categoria FROM infobook_net.produtos pr inner join categorias ca on pr.codigo_categoria = ca.codigo_categoria";
Response.Write(sql);
cmd.CommandText = sql;
cmd.Connection = sqlConnection1;
try
{
sqlConnection1.Open();
MySqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
GridView1.DataSource = reader;
GridView1.DataBind();
}
}
else
{
Response.Write("não foram encontrados dados");
}
}
catch (Exception ex)
{
Response.Write(Convert.ToString(ex));
}
It is running and filling the gridview only when there is more than one return line when it has only one it assembles nothing and shows nothing someone has an idea of how to do?
thank you
Thank you Richard worked out Thank you
– Diego Ferreira de Oliveira