我有这个查询,我必须在 excel 中运行多次,我需要更改其中的文件列表。
select * from files
where
filename in ('filename1','filename2')
所以我在 TEMP 中的查询文件名中有一个 TEMP,我想循环并获取所有文件列表的结果。我唯一的问题是将 .txt 读入 TEMP 并对 txt 文件中的所有文件名执行一次查询。我知道如何逐行读取文件,所以没有帮助。
我想从中读取列表的文本文件就像
文件名 1 文件名 2 。. . . 文件名15000
是的一些大数字。
dim filelist as string
dim filelistpath as string
sqlstring = "select count(*) from files where filename in TEMP"
filelistpath = "c:\"
open filelistpath for input as #1
do while not EOF(1)
line input #1,text
'here i should construct my file list to replace the TEMP below, how ?
loop
close #1
sqlstring = replace(sqlstring,TEMP, filelist)
set rs = conn.execute(sqlstring)
'here i want to write the result to my excel sheet, how ?
谢谢