标准表达式中的数据类型不匹配,我认为下面的代码是正确的,但现在我收到此错误,不确定我添加的内容不正确。
下面的代码发布到数据库
并且函数 Main() 只是连接到数据库
Private Sub adddata()
Main
Dim strSQL As String
Data1 = Sheets("Sticker").Range("B6").Value
Data2 = Sheets("Sticker").Range("D4").Value
Data3 = Sheets("Sticker").Range("A2").Value
Data4 = Sheets("Sticker").Range("C8").Value
Data5 = Sheets("Sticker").Range("B14").Value
Data6 = Sheets("Sticker").Range("D12").Value
Data7 = Sheets("Sticker").Range("A10").Value
Data8 = Sheets("Sticker").Range("C16").Value
strSQL = "INSERT INTO STICKER (CertNo, IssueDate, Serial, RecalDue,CertNo_Vic, IssueDate_Vic, Serial_Vic, RecalDue_Vic)" & _
"VALUES('" & _
Data1 & "','" & _
Data2 & "','" & _
Data3 & "','" & _
Data4 & "','" & _
Data5 & "','" & _
Data6 & "','" & _
Data7 & "','" & _
Data8 & "')"
adoConnection.Execute strSQL, , adCmdText + adExecuteNoRecords
MsgBox "Added info to the db ", vbExclamation, "Connection.Execute"
End Sub