UPDATE语句错误(没有为一个或多个必需参数提供值) [英] UPDATE statment error (no value given for one or more required parameters)

查看:104
本文介绍了UPDATE语句错误(没有为一个或多个必需参数提供值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
在过去的5个小时中,我一直在尝试解决此错误,有人可以告诉我下面的代码出了什么问题.

谢谢

hi all
for the last 5 hrs i am trying to sort out this error , could anyone please tell me what is the wrong with the below code.

thanks

Try
            Dim conn As New OleDbConnection(connstrg)
            Dim sqlstr As String = " select * from admin_skills"
            Dim dt As New DataSet
            Dim n As String = Label1.Text
            Dim dd As Date
            Dim go String
            dd = DateTimePicker6.Value.Date
            If CheckBox16.Checked = True Then
                go = "no"
                  else 
                   go = "yes"
            End If
            
            Dim cmd As New OleDbCommand
            cmd.Connection = conn
            cmd.CommandType = CommandType.Text
            conn.Open()
            cmd = New OleDbCommand("UPDATE admin_skills SET goods=?,g_date=?,g_accp=? where op_id=?", conn)
            cmd.Parameters.AddWithValue("goods", go)
            cmd.Parameters.AddWithValue("g_date", dd)
            cmd.Parameters.AddWithValue("g_accp", go)
            
            cmd.ExecuteNonQuery()
            conn.Close()
            MsgBox(" Record Updated  ", MsgBoxStyle.Information)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

推荐答案

您必须在where子句中提供参数op_id的值.

希望对您有所帮助.

-------------------------------------------------- --------------
签名:瓜鲁柳斯的威尼斯公寓
You must supply a value for the parameter op_id, which is in the where clause.

I hope this helps.

----------------------------------------------------------------
Signature: Apartamentos a venda em Guarulhos


这篇关于UPDATE语句错误(没有为一个或多个必需参数提供值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆