我在VBA做一个项目。我已经成功连接并检索了我的表格。现在我想从Excel更新几个列。当我运行此代码时,它不会抛出任何错误,但我的表中的值永远不会改变。
sqlstr = "UPDATE " & table4 & " SET price = '" & Cells(i, 8) & ", & "
& Cells(i, 9) & "' " & " WHERE key_id = '" & Cells(i, 1) & ", & " & Cells(i, 2) & "' "
当我使用一个值运行较短版本时,它会更新它。
sqlstr = "UPDATE " & table4 & " SET price = '" & Cells(i, 8) & "' " & "
WHERE key_id = '" & Cells(i, 1) & "' "
我哪里错了?
答案 0 :(得分:0)
你在语法
中遗漏了'引号sqlstr = "UPDATE " & table4 & " SET price = '" & Cells(i, 8) & "' " & "
& Cells(i, 9) & "' " & " WHERE key_id = '" & Cells(i, 1) & ", & " & Cells(i, 2) & "' "