我已经用精细的牙齿梳理了这个并且无法找到语法错误,我已经在访问中对其进行了测试并且它工作正常,任何人都可以看到错误吗?
Dim Day As String = CmbDay.Text
Dim Time As String = TxtTime.Text
Dim Club As String = TxtClub.Text
Dim Room As String = TxtRoom.Text
Dim Requirement As String = TxtRequire.Text
Dim order As String = "0"
If Day = "Monday" Then
order = "1"
ElseIf Day = "Tuesday" Then
order = "2"
ElseIf Day = "Wednesday" Then
order = "3"
ElseIf Day = "Thursday" Then
order = "4"
ElseIf Day = "Friday" Then
order = "5"
End If
Access.ExecQuery("INSERT INTO Clubs (Daysort, ClubName, Times, Day, Room, Requirement) VALUES ('" & order & "','" & Club & "', '" & Time & "', '" & Day & "', '" & Room & "', '" & Requirement & "');")
If Not String.IsNullOrEmpty(Access.Exception) Then MsgBox(Access.Exception) : Exit Sub
答案 0 :(得分:0)
尝试删除SQL末尾的; ,
从
改变Access.ExecQuery("INSERT INTO Clubs (Daysort, ClubName, Times, Day, Room, Requirement) VALUES ('" & order & "','" & Club & "', '" & Time & "', '" & Day & "', '" & Room & "', '" & Requirement & "');")
到
Access.ExecQuery("INSERT INTO Clubs (Daysort, ClubName, Times, Day, Room, Requirement) VALUES ('" & order & "','" & Club & "', '" & Time & "', '" & Day & "', '" & Room & "', '" & Requirement & "')")
答案 1 :(得分:0)
你应该试试这个
Access.ExecQuery("INSERT INTO Clubs ([Daysort], [ClubName], [Times], [Day], [Room], [Requirement]) VALUES ('" & order.Text & "','" & Club.Text & "', '" & Time.Text & "', '" & Day.Text & "', '" & Room.Text & "', '" & Requirement.Text & "')")