jrivet
Messages postés7392Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention 6 avril 201260 1 oct. 2008 à 08:21
Salut,
Regarde si ceci peut t'aider.
(=> Il suffit de regarder de plus près l'objet CheckListBox pour se rendre compte qu'il possède un collection CheckedItems (L'aide est très utile pour cela)
'on cr,e une connexion
Dim MyConnexion As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Technique\bdtechnique.mdb;")
'on ajoute une commande avec le code sql
Dim Mycommand1 As OleDbCommand = MyConnexion.CreateCommand()
'on ouve la connexion
MyConnexion.Open()
For i As Integer = 0 To chek1.CheckedItems.Count - 1
Mycommand1.CommandText = "DELETE * FROM Planning WHERE Planning.Travail='" & chek1.CheckedItems(i).ToString & "'"
Dim MyDataAdapter As New OleDbDataAdapter(Mycommand1)
'on exécute la commande
MyDataAdapter.UpdateCommand = Mycommand1
MyDataAdapter.UpdateCommand.ExecuteNonQuery()
MsgBox ("planning " & chek1.CheckedItems(i).ToString & " supprimé,")
Next
'et on ferme la connexion
MyConnexion.Close()
, ----
[../code.aspx?ID=41455 By Renfield]