我在 VBA Excel 的代码中使用此插入语句,但我无法将其分成多行:
SqlQueryString = "Insert into Employee values(" & txtEmployeeNo.Value & " _
,'" & txtContractStartDate.Value & "' _
,'" & txtSeatNo.Value & "' _
,'" & txtFloor.Value & "','" & txtLeaves.Value & "')"
它给出错误“预期语句结束”。我该如何修复它?
最佳答案
不能在字符串内使用 VB 续行符。
SqlQueryString = "Insert into Employee values(" & txtEmployeeNo.Value & _
"','" & txtContractStartDate.Value & _
"','" & txtSeatNo.Value & _
"','" & txtFloor.Value & "','" & txtLeaves.Value & "')"
关于vba - 如何将长字符串分成多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16624550/