locked
Syntax error in update statement. Can you have too many variables/members in statement. RRS feed

  • Question

  • I get a syntax in the update statement:
    Dim cmd As New OleDb.OleDbCommand(sqlstr, connect).
    Is there a limitation to the number of variables I can put in the update statement because if I reduce the statement by one variable the update works.
    --------------------------------------------------------------------------------------------------------
           
    Dim connectstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\lasergage.mdb"
    Dim sqlstr, sqlstr1 As String
    Dim connect As OleDbConnection
    partInfo.partNumber = "12222"
    partInfo.paddleStyle = "n"
    partInfo.partSize = 9
    partInfo.numberOfPaddles = 9
    partInfo.orientation = "Glenn"
    partInfo.printText = "Meisner"
    partInfo.spacesAfterPart = 2
    partInfo.spacesAfterOrientation = 3
    partInfo.spacesAfterDate = 4
    partInfo.spacesAfterTime = 5
    partInfo.spacesBeforePrinting = 6
    partInfo.printSide = 7
    partInfo.modelType = 13
     
    sqlstr = 
    "Update PartTable Set PartNumber='" & partInfo.partNumber & "',PaddleStyle='" & partInfo.paddleStyle & "',PartSize='" & partInfo.partSize & "',NumberOfPaddles='" & partInfo.numberOfPaddles & "',Orientation='" & partInfo.orientation & "',PrintText='" & partInfo.printText & "',SpacesAfterPart='" & partInfo.spacesAfterPart & "',SpacesAfterOrientation='" & partInfo.spacesAfterOrientation & "',SpacesAfterDate='" & partInfo.spacesAfterDate & "',SpacesAfterTime'" & partInfo.spacesAfterTime & "' WHERE PartNumber='" & partInfo.partNumber & "'"
    connect = New OleDbConnection(connectstring)
    connect.Open()
    Try
    Dim cmd As New OleDb.OleDbCommand(sqlstr, connect)
    cmd.ExecuteNonQuery()
    MsgBox("Updated successfully")
    Catch ex As Exception
    MsgBox(ex.ToString)
    End Try

    Monday, July 23, 2012 5:23 AM

Answers