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
| Private Sub UpdateFeuille()
'''''''''''''''''''''''''''''
' Alimentation du combo 1
'''''''''''''''''''''''''''''
Dim MyConnexion As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Application.StartupPath & "\gestionjoueurs.mdb;")
Dim Mycommand As OleDbCommand = MyConnexion.CreateCommand()
Mycommand.CommandText = "SELECT T_Joueur.IDJoueur,T_Joueur.Nom, T_Joueur.Prenom, T_Joueur.Dispo,T_Joueur.Init , T_Joueur.Pilier from T_Joueur where (T_Joueur.Dispo=1 and T_Joueur.Pilier=true and T_Joueur.Init=true)"
MyConnexion.Open()
Dim myReader As OleDbDataReader = Mycommand.ExecuteReader()
ComboBox1.Items.Clear()
Do While myReader.Read()
strIdentifiant = CStr(myReader.GetValue(0))
intLong = strIdentifiant.Length
strIdentifiant = ""
If intLong < 4 Then
Dim i As Integer
For i = 1 To (5 - intLong)
strIdentifiant = strIdentifiant & " "
Next
strIdentifiant = strIdentifiant & CStr(myReader.GetValue(0))
strNomPrenom = strIdentifiant & " :" & myReader.GetString(1) & " " & myReader.GetString(2)
End If
ComboBox1.Items.Add(strNomPrenom)
Loop
myReader.Close()
MyConnexion.Close()
Me.Refresh()
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim MyConnexion2 As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Application.StartupPath & "\gestionjoueurs.mdb;")
Dim Mycommand2 As OleDbCommand = MyConnexion2.CreateCommand()
strToto = Mid(Me.ComboBox1.Text, 1, 5)
If strToto <> "" Then
If CInt(strToto) > 0 Then
Mycommand2.CommandText = ("UPDATE T_JOUEUR SET INIT=false WHERE IdJoueur=") & CInt(strToto)
MyConnexion2.Open()
Dim myReader2 As OleDbDataReader = Mycommand2.ExecuteReader()
MyConnexion2.Close()
End If
End If
End Sub |
Partager