Parameter '@logo' has already benn defined
Bonjour,
Mon bouton click pose probleme.
Une fois fais le premier click il sauvegarde correctement mais au second j'ai cette erreur:
Code:
Parameter '@logo' has already benn defined
Voici mon code. Merci de vos commentaires ou modifications suggérer.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Verificar DNI Duplicado'
MysqlConn.Open()
COMMAND.CommandText = "select * from scale where name = '" & TextBox3.Text & "'"
READER = COMMAND.ExecuteReader
If READER.HasRows Then
MsgBox("Scale Duplicated !", MsgBoxStyle.Critical)
Me.Show()
MysqlConn.Close()
Else
MysqlConn.Close()
MysqlConn.Open()
MysqlConn.Dispose()
'Verificar DNI Duplicado'
Me.Cursor = Cursors.WaitCursor
'Guardar Imagen
Dim mstream As New System.IO.MemoryStream()
PictureBox1.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Png)
Dim arrImage() As Byte = mstream.GetBuffer()
mstream.Close()
'Guardar Imagen'
Try
MysqlConn.Open()
COMMAND.Connection = MysqlConn
COMMAND.CommandType = CommandType.Text
COMMAND.CommandText = "insert into scale (name, logo) values ('" & TextBox3.Text & "', @logo)"
COMMAND.Parameters.AddWithValue("@logo", arrImage)
READER = COMMAND.ExecuteReader
MessageBox.Show("Datos Guardados")
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
End If
MysqlConn.Close()
Me.Cursor = Cursors.Default
End Sub |