获得异常:检查与MySQL服务器版本对应的手册以获得正确的语法

时间:2013-10-24 12:07:14

标签: mysql sql vb.net vb.net-2010 executenonquery

我在更新数据库中的值时遇到MySqlException错误。值正在正确选取,而ExecuteNonQuery()无法正常运行。

例外:“检查与MySQL服务器版本对应的手册,以便在'release ... 附近使用正确的语法”

请查看我的代码并协助我。

Try
            If main_form.mySQLconn1.State = ConnectionState.Closed Then
                main_form.mySQLconn1.Open()
            End If

        For Each assprno As String In lstPO.Items
            Dim alloc() As String = Regex.Split(assprno, "/")

            If Microsoft.VisualBasic.Left(alloc(0), 3) = "SBB" Then
                main_form.cmdieg.CommandText = "UPDATE ieg SET assto = @assto, procby = @procby, assby = @assby, assdate = @assdate, falloutstatus = @falloutstatus, orderstatus = @orderstatus, orderdetails = @orderdetails, ticketno = @ticketno, newpr = @newpr, newpo = @newpo, rftype = @rftype, release = @release, followup = @followup WHERE pono = @pono"
                main_form.cmdieg.Parameters("@pono").Value = Trim(alloc(0))
                ' main_form.cmdieg.Parameters("@orderno").Value = Trim(alloc(2))
            End If

            main_form.cmdieg.CommandType = CommandType.Text
            savedRec = savedRec + 1

            main_form.cmdieg.Parameters("@assby").Value = main_form.userAcct(0)
            'main_form.cmdieg.Parameters("@itemid").Value = row.Cells(8).Value
            main_form.cmdieg.Parameters("@assto").Value = Trim(getUserName)
            main_form.cmdieg.Parameters("@procby").Value = Trim(getUserName)
            main_form.cmdieg.Parameters("@assdate").Value = getToday(Now)
            main_form.cmdieg.Parameters("@falloutstatus").Value = Trim(qrysts)
            main_form.cmdieg.Parameters("@orderstatus").Value = Trim(status)
            main_form.cmdieg.Parameters("@orderdetails").Value = Trim(ordertype)
            main_form.cmdieg.Parameters("@ticketno").Value = Trim(ticket)
            'main_form.cmdieg.Parameters("@ticketno").Value = Trim(txtTicket.Text)
            main_form.cmdieg.Parameters("@newpr").Value = Trim(newpr)
            'main_form.cmdieg.Parameters("@newpr").Value = Trim(txtPR.Text)
            main_form.cmdieg.Parameters("@newpo").Value = Trim(newpo)
            'main_form.cmdieg.Parameters("@newpo").Value = Trim(txtPOno.Text)
            main_form.cmdieg.Parameters("@rftype").Value = Trim(type)
            main_form.cmdieg.Parameters("@release").Value = Trim(release)
            main_form.cmdieg.Parameters("@followup").Value = Trim(followup)
            main_form.cmdieg.ExecuteNonQuery()
        Next

        'main_form.cmdieg.Connection = main_form.mySQLconn1
        'main_form.cmdieg.ExecuteNonQuery()

    Catch ex As Exception
        MsgBox("Database Error: " & ex.ToString() & vbCrLf & "The error have been logged .... ", MsgBoxStyle.OkOnly, main_form.dbErrTitle)
        writeLogs("Database Error: " & ex.ToString())
    Finally
        main_form.mySQLconn1.Close()
    End Try

0 个答案:

没有答案