excel的VBA中SQL语句的写法
rs.Open "select * from table1 t where t.name= 变量", conn, adOpenStatic, adLockOptimistic
'字段为数值型:sql=" select * from tablename where 字段名="& 变量 &""'字段为字符型:sql=" select * from tablename where 字段名='"& 变量 &"'"
[解决办法]
'字段为数值型:
sql=" select * from tablename where 字段名="& 变量 &""
'字段为字符型:
sql=" select * from tablename where 字段名='"& 变量 &"'"