Visual Basic - VB + Update valeur Null MYSQL + Parameters.AddWithValue

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil

VB + Update valeur Null MYSQL + Parameters.AddWithValue

Publicado por Jamyz (1 intervención) el 09/11/2021 12:12:41
Hola,
Intento actualizar y poner un valor NULL en la base de datos mysql con VB.
Pero no se que falla que no me funciona.
Cuando uso el comando por un cliente mysql funciona correctamente.

1
update Produccion set Lote_cliente = NULL where id = 193261

Pero con VB no me funciona

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MessageBox.Show("Put id, please", "hahahaha", MessageBoxButtons.OK, MessageBoxIcon.Warning)
        Else
            Dim conn As New MySqlConnection(ConfigurationManager.ConnectionStrings("COUCOU_OVH_MARIADB").ToString)
                conn.Open()
            Try
                Dim cmd As New MySqlCommand("update Produccion set Lote_cliente = NULL where id = @id", conn)
                cmd.Parameters.AddWithValue("@id", TextBox1.Text)
 
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            Finally
                conn.Dispose()
                End Try
                MessageBox.Show("NULL VALUE ADD", "hahahaha", MessageBoxButtons.OK, MessageBoxIcon.Information)
                conn.Close()
            'End If
 
        End If
    End Sub

Que podria ser ? Es poner un valor NULL en Lote_cliente con el id igual al textbox1.text.
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder