没有给出一个或多个必需参数的值?

时间:2016-03-29 13:20:35

标签: vb.net

请帮我解决这个问题。我只是一个初学者而且不知道出了什么问题。

我的身份证号码是自动编号,可能是因为缺少?

        If TextBox3.Text = "APEL" Then

            Dim up As New OleDbCommand
            up.Connection = cn
            up.CommandText = "UPDATE APEL SET ID=@a, NME=@b, TOPIC=@c, DTE=@d where ID=@a"

            up.Parameters.Add(New OleDbParameter("@a", OleDbType.VarChar, 50))
            up.Parameters.Add(New OleDbParameter("@b", OleDbType.VarChar, 50))
            up.Parameters.Add(New OleDbParameter("@c", OleDbType.VarChar, 50))
            up.Parameters.Add(New OleDbParameter("@d", OleDbType.VarChar, 50))

            up.Prepare()

            up.Parameters("@a").Value = TextBox4.Text
            up.Parameters("@b").Value = TextBox1.Text
            up.Parameters("@c").Value = TextBox2.Text
            up.Parameters("@d").Value = TextBox6.Text

            up.ExecuteNonQuery()

            MsgBox("Data Updated!")
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""
            TextBox6.Text = ""
            Me.Hide()

        End If

0 个答案:

没有答案