如何解决update语句中的语法错误 [英] How to solve syntax error in update statement

查看:120
本文介绍了如何解决update语句中的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用此代码时,它会在更新语句中给出语法错误,请帮我解决此错误



我尝试了什么:



when i tried this code it is giving syntax error in update statement please help me solve this error

What I have tried:

  Public Sub ud()
        Try
            Dim oledbcommand As String = "UPDATE Personal  SET EmpID=? , EmpName=? , CATIAV5=? , UGNX=? , FIDES=? , PROE=? , SOLIDWORKS=? , SOLIDEDGE=? , ROBCAD=? , PROCESSSIMULATE=? , DECIMA=? , IGRIP=? , QUEST=? , EMPLANT=? , PROCESSDESIGNER=? , AutoCAD=? , FACTORYCAD=? , MICROSTATION=? , VBA=? , C/C++ =? , VBdotNET=? "
            Dim com As New OleDb.OleDbCommand(oledbcommand, con)
            com.Connection = con
            com.Parameters.AddWithValue("?", cboxempid.Text)
            com.Parameters.AddWithValue("?", cboxfname.Text)
            com.Parameters.AddWithValue("?", cboxcatia.Text)
            com.Parameters.AddWithValue("?", cboxugnx.Text)
            com.Parameters.AddWithValue("?", cboxfides.Text)
            com.Parameters.AddWithValue("?", cboxproe.Text)
            com.Parameters.AddWithValue("?", cboxsworks.Text)
            com.Parameters.AddWithValue("?", cboxsedge.Text)
            com.Parameters.AddWithValue("?", cboxrcad.Text)
            com.Parameters.AddWithValue("?", cboxpsimulate.Text)
            com.Parameters.AddWithValue("?", cboxdecima.Text)
            com.Parameters.AddWithValue("?", cboxigrip.Text)
            com.Parameters.AddWithValue("?", cboxquest.Text)
            com.Parameters.AddWithValue("?", cboxem.Text)
            com.Parameters.AddWithValue("?", cboxpdesigner.Text)
            com.Parameters.AddWithValue("?", cboxauto.Text)
            com.Parameters.AddWithValue("?", cboxfcad.Text)
            com.Parameters.AddWithValue("?", cboxmsta.Text)
            com.Parameters.AddWithValue("?", cboxvba.Text)
            com.Parameters.AddWithValue("?", cboxc.Text)
            com.Parameters.AddWithValue("?", cboxdotnet.Text)
            For Each parameter As OleDb.OleDbParameter In com.Parameters
                If parameter.Value Is Nothing Then
                    parameter.Value = DBNull.Value

                End If
            Next
            com.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        con.Close()
        con.Dispose()
    End Sub
End Class

推荐答案

喜欢这个



like this

Dim oledbcommand As String = "UPDATE Personal  SET EmpID=@EmpID , EmpName=@EmpName , CATIAV5=@CATIAV5 , ......."
            Dim com As New OleDb.OleDbCommand(oledbcommand, con)
            com.Connection = con
            com.Parameters.AddWithValue("@EmpID", cboxempid.Text)
            com.Parameters.AddWithValue("@EmpName", cboxfname.Text)
            com.Parameters.AddWithValue("@CATIAV5", cboxcatia.Text)
            .
            .
            .





参考 vb sql参数 [ ^ ]


这篇关于如何解决update语句中的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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