1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Public Sub charger_article()
cn.Open()
Dim liste() As String
ReDim liste(DataGridView1.Rows.Count + 1)
For i = 0 To DataGridView1.Rows.Count - 1
liste(i) = DataGridView1(1, i).Value
Next
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
cmd.Connection = cn
cmd.CommandText = "select designationArticle from Article where designationArticle not IN '" & liste() & "'"
Dim Dgvc As New DataGridViewComboBoxCell
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
Dgvc.Items.Add(dr(0))
End While
DataGridView1.Item(1, ind) = Dgvc
End If
dr.Close()
cn.Close()
End Sub |
Partager