我不明白。这个查询有什么问题
While _drRemoteData.Read
Dim _Query As String = "insert into SchedularTicketsData (RemoteDBID,key,Transno,DateEntered,DateUpdated) values (" & _dbrStores.Item("id") & "," & _drRemoteData("Key") & "," & _drRemoteData("TransNo") & ",NOW(),NOW())"
_cmdExecute = New OleDb.OleDbCommand(_Query, _ConLMS)
Try
_cmdExecute.ExecuteNonQuery()
WriteLog("Ticket number added " & _drRemoteData("TransNo"))
Catch ex As Exception
WriteLog("Ticket number not added " & _drRemoteData("TransNo"))
WriteLog("Error message: " & ex.Message)
Exit Sub
End Try
End While
执行前的调试器显示查询
"插入SchedularTicketsData (RemoteDBID,key,Transno,DateEntered,DateUpdated)值 (167,28570,28412,NOW(),NOW())"
执行给我一个错误:
INSERT INTO语句中的语法错误。
截图
答案 0 :(得分:1)
Key
是reserved word in ms-access。把它放在方括号中它应该有效:
Dim _Query As String = "insert into SchedularTicketsData (RemoteDBID, [key], Transno,...