1 2 3 4 5 6 7 8 9 10 11 12 13 14
| ObjetConnection.Open()
ObjetCommand = New OleDbCommand
ObjetCommand.Connection = ObjetConnection
ObjetCommand.CommandType = CommandType.Text
ObjetCommand.CommandText = " INSERT INTO Composant (CE_typeComposant, nom_Composant, nombre_Composant, datasheet_Composant) " & _
" VALUES (('" & Me.Lstbox_choixTypeComposant.SelectedValue & "'),('" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & " '), ('" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(1).Value & " '), ('" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(2).Value & " '))" & _
" ON DUPLICATE KEY UPDATE ((CE_typeComposant = '" & Me.Lstbox_choixTypeComposant.SelectedValue & "'), (nom_Composant = '" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(0).Value & " '), (nombre_Composant = '" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(1).Value & " '), (datasheet_Composant = '" & Me.DataGridView1.Rows(DataGridView1.CurrentCell.RowIndex).Cells(2).Value & " '));"
ObjetCommand.ExecuteNonQuery()
ObjetConnection.Close() |