1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
Private Sub BtnModifier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnModifier.Click
If Me.Txtdatevol.Text = "" Or Me.TxtHeuredep.Text = "" Or Me.Txtheurearriv.Text = "" Or Me.Txtnumpilote.Text = "" _
Or Me.Txtnumavion.Text = "" Or Me.Txtnumtrajet.Text = "" Then
MessageBox.Show("Vous devez remplir tous les champs !", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
Me.Cmbpilote.Focus()
Exit Sub
End If
Txtdatevol.Format = DateTimePickerFormat.Short
'
'strSQL = "UPDATE personnes SET nom='" & txtNom.Text & "', prenom='" & txtPrenom.Text & "', tel='" & txtTel.Text & "', email='" & txtEmail.Text & "' WHERE id=" & lblId.Text
'
Ocommande.CommandText = "UPDATE EFFECTUER set Heuredep ='" & TxtHeuredep.Text & "', Heurearriv ='" & Txtheurearriv.Text & "' WHERE Numpilote = '" & Txtnumpilote.Text & "' AND Numavion = '" _
& Txtnumavion.Text & "' AND Numtrajet = '" & Txtnumtrajet.Text & "' AND Datevol = '" & Txtdatevol.Text & "'"
Ocommande.Connection = Oconnexion
Try
'Oconnexion.Open()
Ocommande.ExecuteNonQuery()
MsgBox(" Modification réalisée pour EFFECTUER")
Catch ex As OleDb.OleDbException
MsgBox(ex.ToString)
Exit Sub
End Try
Ocommande.CommandText = "SELECT Numpilote, Numavion, Numtrajet, Datevol, Heuredep, Heurearriv FROM EFFECTUER"
Odreader = Ocommande.ExecuteReader 'récuperation du resultat de l'exécution de la requête cmd
Dim i As Integer = 0
Do While Odreader.Read 'tanque on peut lire un enregistrement
'DataGridView1.Rows.Add() 'ajout de ligne
DataGridView1.Rows(i).Cells(0).Value = Odreader(0) 'affichage de colonne
DataGridView1.Rows(i).Cells(1).Value = Odreader(1)
DataGridView1.Rows(i).Cells(2).Value = Odreader(2)
DataGridView1.Rows(i).Cells(3).Value = Odreader(3)
DataGridView1.Rows(i).Cells(4).Value = Odreader(4)
DataGridView1.Rows(i).Cells(5).Value = Odreader(5)
i = i + 1
Loop
Oconnexion.Close()
End Sub
If Me.Txtdatevol.Text = "" Or Me.TxtHeuredep.Text = "" Or Me.Txtheurearriv.Text = "" Or Me.Txtnumpilote.Text = "" _
Or Me.Txtnumavion.Text = "" Or Me.Txtnumtrajet.Text = "" Then
MessageBox.Show("Vous devez remplir tous les champs !", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
Me.Cmbpilote.Focus()
Exit Sub
End If
Txtdatevol.Format = DateTimePickerFormat.Short
'
'strSQL = "UPDATE personnes SET nom='" & txtNom.Text & "', prenom='" & txtPrenom.Text & "', tel='" & txtTel.Text & "', email='" & txtEmail.Text & "' WHERE id=" & lblId.Text
'
'Ocommande.CommandText = "update EFFECTUER set heuredep ='" & TxtHeuredep.Text & "', heurearriv ='" & Txtheurearriv.Text & "' WHERE Numpilote = '" & Txtnumpilote.Text & "' AND Numavion = '" & Txtnumavion.Text & "' AND Numavion = '" & Txtnumavion.Text & "'AND Datevol = '" & Txtdatevol.Text & "'"
Ocommande.CommandText = "DELETE FROM EFFECTUER WHERE Numpilote = '" & Txtnumpilote.Text & "' AND Numavion = '" & Txtnumavion.Text & "' AND Numtrajet = '" & Txtnumtrajet.Text & "'AND Datevol = '" & Txtdatevol.Text & "'"
Ocommande.Connection = Oconnexion
Try
'Oconnexion.Open()
Ocommande.ExecuteNonQuery()
MsgBox(" Suppression réalisée pour EFFECTUER")
Catch ex As OleDb.OleDbException
MsgBox(ex.ToString)
Exit Sub
End Try
Ocommande.CommandText = "SELECT Numpilote, Numavion, Numtrajet, Datevol, Heuredep, Heurearriv FROM EFFECTUER"
Odreader = Ocommande.ExecuteReader 'récuperation du resultat de l'exécution de la requête cmd
Dim i As Integer = 0
Do While Odreader.Read 'tanque on peut lire un enregistrement
'DataGridView1.Rows.Add() 'ajout de ligne
DataGridView1.Rows(i).Cells(0).Value = Odreader(0) 'affichage de colonne
DataGridView1.Rows(i).Cells(1).Value = Odreader(1)
DataGridView1.Rows(i).Cells(2).Value = Odreader(2)
DataGridView1.Rows(i).Cells(3).Value = Odreader(3)
DataGridView1.Rows(i).Cells(4).Value = Odreader(4)
DataGridView1.Rows(i).Cells(5).Value = Odreader(5)
i = i + 1
Loop
Oconnexion.Close()
End Sub |
Partager