您可以使用WHS。例如,我在目录'C:\ Users \ user837 \ Desktop \ t4'中有4个文件:1.txt
id;sex_ref;sale
1;1;10
2;2;30
3;1;20
2.txt
sex_id;name
1;male
2;female
schema.ini
[1.txt]
Format=Delimited(;)
ColNameHeader=True
MaxScanRows=50
DecimalSymbol=,
[2.txt]
Format=Delimited(;)
ColNameHeader=True
MaxScanRows=50
DecimalSymbol=,
和Hello.js
WScript.Echo("Hello World!");
var cn = new ActiveXObject("ADODB.Connection");
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\Users\\user837\\Desktop\\t4\";Extended Properties=\"text;HDR=NO;FMT=Delimited\"");
var rs = cn.Execute("select * from 1.txt as t1 left join 2.txt as t2 on t1.sex_ref = t2.sex_id");
while (!rs.EOF)
{
WScript.Echo( rs.Fields("id").Value
+ "###" + rs.Fields("sex_ref").Value
+ "###" + rs.Fields("name").Value
);
rs.moveNext();
}
现在只需双击Hello.js,您将逐行看到sql reqult。请参阅WHS文档以查看所有查询结果。