how to make a good query with vb.net

  • Thread starter Thread starter Houssem12
  • Start date Start date
H

Houssem12

Guest
Hi members

i import textfile to a datagridview after i make a test if element (DO_Piece and AR_Ref) exist in database or not if exist i do somthing if not i turn the row to red

after many test i see that test for DO_Piece work fine but for AR_Ref not

this is my query

For j As Integer = 0 To DataGridView1.Rows.Count - 2
Dim cmd As New SqlCommand("select cbMarq,AR_Ref from F_DOCLIGNE where DO_Piece='" & DataGridView1.Rows(j).Cells(0).Value & "' and AR_Ref like '%" & DataGridView1.Rows(j).Cells(1).Value & "%'", cn)
Using da As SqlDataReader = cmd.ExecuteReader


If da.HasRows Then
please help

Continue reading...
 
Back
Top