0
Good afternoon. I have a c# theme that contains a datagridviwer, and I am populating this datagridiview directly with a database query, but it has a column that needs to be in select, but I cannot show the user in datagridiview, how can I make this column invisible. The column [N° Solic. ] has to be invisible to the user.
follows the code that populates the datagridview.
private void ListaGrid()
{
string strSQL = @"select distinct
pro.Cod_Produto as CODIGO,
pro.NomeProduto as PRODUTO,
pro.Lote as LOTE,
pro.Fabricante AS REPRESENTADA,
pro.Qtda as QTDA,
sa.Id_Solicitacao AS [N° Solic.]
from tbl_SolicitacaoAmostra as sa
inner join tbl_Produto as pro with (nolock) on pro.Id_Solicitacao = sa.Id_Solicitacao
where sa.Cod_Solictacao = '" + txt_numero.Text + "'";
comando = new SqlCommand(strSQL, conex1);
try
{
SqlDataAdapter dados = new SqlDataAdapter(comando);
DataTable dtLista = new DataTable();
dados.Fill(dtLista);
DGW_itens.DataSource = dtLista;
}
catch
{
MessageBox.Show("Não existem dados a serem encontrados");
}
}
You set the columns beforehand (by the designer)?
– Jéf Bueno
So do not set no, mount straight when I read the query it already shows the columns according to the names I put in the query.
– Junior Guerreiro