Requete avec multi parametre
bonjour,
voici un bout de code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Try
Dim MyConnexion As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & "C:\Pointage\pointage.mdb")
Dim Mycommand As OleDbCommand = MyConnexion.CreateCommand()
MyConnexion.Open()
Mycommand.CommandText = "UPDATE [Actions] SET [nom_Action] = @nom1 WHERE [ID_Action] = (SELECT [ID_Action] FROM [Actions] WHERE [nom_Action] = @nom2)"
Dim nom1 As New System.Data.OleDb.OleDbParameter("@nom1", System.Data.OleDb.OleDbType.Char, 0, "@nom1")
Dim nom2 As New System.Data.OleDb.OleDbParameter("@nom2", System.Data.OleDb.OleDbType.Char, 0, "@nom2")
nom1.Value = TextBox2.Text.ToString
Mycommand.Parameters.Add(nom1)
nom2.Value = ListBox1.SelectedItem.Text.ToString
Mycommand.Parameters.Add(nom2)
MsgBox(Mycommand.CommandText)
Mycommand.ExecuteNonQuery()
MyConnexion.Close()
mise_a_jour_liste()
TextBox2.Text = ""
Catch ex As Exception
MsgBox("Une exception s'est declenche, veuillez contacter le service informatique")
End Try |
Aucune erreur ne se déclenche , mais rien ne se passe ?