SSS RRR

SSS RRR

  • 2k
  • 27
  • 198

Get only the last result

Jan 20 2021 11:06 AM
Hey. Why do I only get the last result with this code? 
  1. foreach (DataGridViewRow dr in dgvOperation.Rows)  
  2. {  
  3. var query = @"GetFullText";  
  4. SqlCommand cmd = new SqlCommand(query, con);  
  5. cmd.CommandType = CommandType.StoredProcedure;  
  6. cmd.Parameters.AddWithValue("@Text", dr.Cells[2].Value.ToString());  
  7. cmd.Parameters.AddWithValue("@Klientnavn", txtKlientNavn.Text);  
  8.   
  9. DataTable dt = new DataTable();  
  10. var sda = new SqlDataAdapter();  
  11. sda.SelectCommand = cmd;  
  12. sda.Fill(dt);  
  13. dgvOperation1.DataSource = dt;  
  14. }  

Answers (9)