Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 MySQL 和 EXCEL(VBA) 如何将 sql 查询值传递给变量?
我有一个变量 Dim-ed:
Dim sqlVar As Variant
它是变体,因为我不确定应该使用哪种类型。我已将 sql 查询设置为如下变量:
sqlVar = "SELECT datum FROM arfolyam ORDER BY datum ASC LIMIT 1 "
但是像这样,它存储的是sql查询,而不是查询的值!
有任何想法吗?
... Dim strSQL as String ... strSQL = "SELECT column FROM table ORDER BY column DESC LIMIT 1" Set rs = cn.Execute(strSQL) variable1 = rs.Fields(0).Value
这样,在这种情况下,sql 查询的值是一个单元格,将被赋予变量 1