TwoDent
TwoDent

Reputation: 385

Values were not specified for some of the required parameters (UPDATE Clause)

Another ghost mistake that I cant see what is the cause... this time with my update clause:

Protected Friend Sub modificarC(ByVal cad As String, ByVal empres As String, ByVal direcc As String, ByVal tel As String, ByVal corr As String, ByVal comen As String)
    Dim com As String = "Update Cliente SET Empresa=@Empresa,Direccion=@Direccion,Telefono=@telfono,Correo=@Correo,Comentario=@Comentario WHERE Id_Cliente=@Id_Cliente"
    Try
        con.Open()
        comando = New OleDbCommand(com, con)
        comando.Parameters.AddWithValue("@Empresa", empres)
        comando.Parameters.AddWithValue("@Direccion", direcc)
        comando.Parameters.AddWithValue("@Telefono", tel)
        comando.Parameters.AddWithValue("@Correo", corr)
        comando.Parameters.AddWithValue("@Comentario", comen)
        comando.Parameters.AddWithValue("@Id_Cliente", cad)
        comando.ExecuteNonQuery()
        comando.Dispose()
        con.Close()
    Catch ex As Exception
        con.Close()
        MsgBox("Problemas en la consulta: " + ex.Message(), MsgBoxStyle.Critical)
    End Try
End Sub

And the strangest thing is that I lead me to another query of the same type that it works...

Error message

"Values were not specified for some of the required parameters"

The parameters are declared in the same order as the table and add them in the same order as the query , because im using Access.

How can I fix this issue?

Upvotes: 0

Views: 113

Answers (1)

ShawnOrr
ShawnOrr

Reputation: 1329

Update the spelling for the Telefono parameter in your query to @Telefono. You have it set to @telfono.

Upvotes: 1

Related Questions