0
I need to do one foreach per item in my code only I’m not able to accomplish.
Ex.: I have a note that has 2 items, and I need to read the information of the note per item, I read item 01 and then I read item 02, only I’m not able to implement it in my code below.
Follows my code.
private void btn_laudo_Click(object sender, EventArgs e)
{
string ItemNota = @"SELECT
SD.D2_COD,
SD.D2_LOTECTL,
QR.QER_REVI,
SD.D2_ITEM
FROM SD2020 AS SD
INNER JOIN QER020 AS QR WITH(NOLOCK) ON QR.QER_LOTE = SD.D2_LOTECTL
WHERE SD.D2_DOC = '" + txt_nota.Text + "' AND SD.D2_ITEM = '" + txt_item.Text + "'";
SqlCommand comando = new SqlCommand(ItemNota, conex);
conex.Open();
SqlDataReader ler = comando.ExecuteReader();
if (ler.Read() == true)
{
txt_lote.Text = ler[1].ToString();
txt_codprod.Text = ler[0].ToString();
txt_revi.Text = ler[2].ToString();
}
conex.Close();
this.CabeçalhoLaudoTableAdapter.Fill_CabLaudo(this.DSLaudosPS.CabeçalhoLaudo, txt_nota.Text, txt_item.Text);
this.CorpoLaudoTableAdapter.Fill_CorpoLaudo(this.DSLaudosPS.CorpoLaudo, txt_codprod.Text, txt_lote.Text, txt_revi.Text);
this.rpw_laudo.RefreshReport();
}
And what is the difficulty, young man?
– Jéf Bueno
And what’s the problem? What did you try to do with
foreach
?– Maniero
then I need to do a foreach to read per item of invoice and I am not able to do this foreach, I need to read item 01 product x and fill the textbox that step inside the reportview that is in the code, ai then read p item 02 product y and pass the information to the textbox in the reportviwer below . I don’t know if I can explain my need.
– Junior Guerreiro
If you notice in my query above I manually fill in the note number and item number below I read and fill in the textbox inside the datareader, there I pass all the parameters filled into the textbox in reportviwer.
– Junior Guerreiro