I have a main form ( form1
) where I load a datagridviwer
and I need to do the following: I have a second form ( form2
) that excludes the selected line in datagridviwer
( form1
), only I need to do that when I delete the line from datagridviwer
with the button on form2
, it closes the screen of form2
and returns to the screen of form1
already updated, ie with the line deleted, how can I do that?
Here is my code that updates datagridviwer
;
{
conm.Open();
adap = new SqlDataAdapter(@"select
sa.Cod_Solicitacao,
cli.Cliente,
cli.Contato,
sa.Solicitante,
sa.Representante,
sa.Area_Atuacao,
sa.Tipo_Envio,
sa.Separador,
convert(varchar(10), cast(Data_Entrega as date), 103) as Finalizado,
cli.Id_Cliente,
sa.Id_Solicitacao
from tbl_SolicitacaoAmostra as sa
inner join tbl_Cliente as cli with(nolock) on cli.Id_Cliente = sa.Id_Cliente
inner join tbl_Produto as pro with(nolock) on pro.Id_Solicitacao = sa.Id_Solicitacao
where sa.Deletado is null and cli.Deletado is null and pro.Deletado is null
group by sa.Cod_Solicitacao, cli.Cliente, cli.Contato, sa.Solicitante, sa.Representante, sa.Separador, sa.Area_Atuacao, sa.Tipo_Envio, sa.Separador, sa.Data_Entrega, cli.Id_Cliente, sa.Id_Solicitacao", conm);
ds = new DataSet();
adap.Fill(ds, "Solicitacao");
DGW_solictacao.DataSource = ds.Tables[0];
conm.Close();
}
MessageBox.Show("Solicitação excluida com sucesso!!!");
this.Dispose();