1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Try
'CBool(Me.DataGridView1.Rows(i).Cells("ART_REF").Value.ToString)
con.Open()
Dim i As Integer = Me.DataGridView1.Rows.Count - 2
Dim trouve As Boolean
Dim b As Integer
If trouve = False Then
For b = 0 To i
cmd = New SqlCommand("select * from ARTICLE values('" & Me.DataGridView1.Rows(b).Cells("ART_REF").Value & "','" & Me.DataGridView1.Rows(b).Cells("ART_FAMILLE").Value & "','" & Me.DataGridView1.Rows(b).Cells("ART_DESEG").Value & "'," & Val(Me.DataGridView1.Rows(b).Cells("ART_PRIX_EURO").Value) & "," & Val(Me.DataGridView1.Rows(b).Cells("ART_PRIX_HT").Value) & ")", con)
cmd.ExecuteNonQuery()
Next
Else
cmd1 = New SqlCommand("update ARTICLE set ART_FAMILLE='" & Me.DataGridView1.Rows(b).Cells("ART_FAMILLE").Value & "',ART_DESEG='" & Me.DataGridView1.Rows(b).Cells("ART_DESEG").Value & "',ART_PRIX_EURO=" & Val(Me.DataGridView1.Rows(b).Cells("ART_PRIX_EURO").Value) & ",ART_PRIX_HT=" & Val(Me.DataGridView1.Rows(b).Cells("ART_PRIX_HT").Value) & " where ART_REF='" & Me.DataGridView1.Rows(b).Cells("ART_REF").Value & "'", con)
cmd1.ExecuteNonQuery()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
con.Close() |
Partager