0

更新数据库中的值时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
4

0 回答 0