Mysql
 sql >> Datenbank >  >> RDS >> Mysql

VB.NET- und MySql-UPDATE-Abfrage

Ihr Befehlstext muss auch parametrisiert werden

cmd.CommandText = " UPDATE incomingdeliveries SET Quantity = @iQuantity + Quantity"
cmd.Parameters.Add(New MySqlParameter("@iQuantity", txtQty.Text))

AKTUALISIERUNG 1

Using _conn As New MySqlConnection("connectionStr here")
    Using _comm As New MySqlCommand()
        With _comm
            .Connection = _conn
            .CommandText = "UPDATE incomingdeliveries SET Quantity = @iQuantity + Quantity"
            .CommandType = CommandType.Text
            .Parameters.AddWithValue("@iQuantity", txtQty.Text)
        End With
        Try
            _conn.Open()
            _comm.ExecuteNonQuery()
        Catch ex As MySqlException
            Msgbox(ex.Message.ToString())
        End Try
    End Using
End Using