When databinding my gridview from data stored in my database I am seeing a small square appear instead of the expected gridview results.

Image of unexpected result

The code I'm using:

 try
        {

               DataTable dsDetalle = new DataTable("Data");
            using (MySqlCommand commandSql = cn.CreateCommand())
            {
                commandSql.CommandType = CommandType.Text;
                commandSql.CommandText = "select * from detalle where iddetalle=@iddetalle and idlocal=@idlocal";
                commandSql.Parameters.AddWithValue("@iddetalle", "txt_boleta.Text");
                commandSql.Parameters.AddWithValue("@idlocal", "txtlocal.Text");
                MySqlDataAdapter sqlAdapter = new  MySqlDataAdapter(commandSql);
                sqlAdapter.Fill(dsDetalle);
            }
            GridView1.DataSource = dsDetalle;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {

            lblerror.Text = ex.ToString();
        }

Related posts

Recent Viewed