1
J'utilise VB.NET avec une base de données MySQL. Je veux mettre à jour ce code pour le faire tout en UN SQL au lieu de TROIS. Quelqu'un sait comment?MISE À JOUR MySQL en utilisant VB.NET
Voici le code que je utilise, fonctionne très bien, mais trop lent avec plusieurs lignes ...
If count3 = "1" Then
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim SQL As String
myCommand.Connection = conn
myAdapter.SelectCommand = myCommand
SQL = "UPDATE employees SET emprole1 = '" & val2 & "' WHERE emprole1 = '" & val1 & "'"
myCommand.CommandText = SQL
myCommand.ExecuteNonQuery()
SQL = "UPDATE employees SET emprole2 = '" & val3 & "' WHERE emprole2 = '" & val2 & "'"
myCommand.CommandText = SQL
myCommand.ExecuteNonQuery()
SQL = "UPDATE employees SET emprole3 = '" & val4 & "' WHERE emprole3 = '" & val3 & "'"
myCommand.CommandText = SQL
myCommand.ExecuteNonQuery()
End If
j'ai pu le faire comme ceci: – BooMGiRL
SQL = "employés UPDATE SET emprole1 = « " & val2 & " 'OÙ emprole1 ='" & val1 & "' ;" SQL & = "employés UPDATE SET emprole2 = « " & val3 & "'O WH emprole2 ='" & val2 " SQL & =" MISE À JOUR des employés SET emprole3 = '"& val4 &"' O WH emprole3 = '"& val3 &"' – BooMGiRL
@BooMGiRL Great –