没有为某些必需参数指定值(UPDATE子句)

时间:2016-04-14 18:04:45

标签: vb.net ms-access

另一个幽灵错误,我无法看出原因是什么......这次是我的更新条款:

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

最奇怪的是,我引导我进入另一个相同类型的查询...

Error message

“未指定某些必需参数的值”

参数以与表相同的顺序声明,并以与查询相同的顺序添加它们,因为即时通讯使用Access。

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

将查询中Telefono参数的拼写更新为 <Offer> <BuyingPrice> <LandedPrice> <CurrencyCode>USD</CurrencyCode> <Amount>33.60</Amount> </LandedPrice> <ListingPrice> <CurrencyCode>USD</CurrencyCode> <Amount>24.45</Amount> </ListingPrice> <Shipping> <CurrencyCode>USD</CurrencyCode> <Amount>9.15</Amount> </Shipping> </BuyingPrice> <RegularPrice> <CurrencyCode>USD</CurrencyCode> <Amount>24.45</Amount> </RegularPrice> <FulfillmentChannel>MERCHANT</FulfillmentChannel> <ItemCondition>New</ItemCondition> <ItemSubCondition>New</ItemSubCondition> <SellerId>YOUR_SELLERID</SellerId> <SellerSKU>YOUR_SKU</SellerSKU> </Offer> 。您已将其设置为@Telefono