我想从 sql server 而不是系统中检索日期。所以我使用 getdate 函数但它在 vba 中不起作用 here is code and error
conn.Execute "insert into dbo.Customers (AccountNo,Amount,code) values ('" & AccountNo & "', '" & Amount & "', '" & getdate() & "')"
最佳答案
您希望 getdate()
由 SQL Server 而不是 VBA 执行。您在 getdate()
周围的错误位置引用了引号:
conn.Execute "insert into dbo.Customers (AccountNo, Amount, code) values ('" & AccountNo & "', '" & Amount & "', getdate())"
关于database - 如何使用vba插入getdate函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39891465/