从 VBscript 变量获取路径以用于 obj.sql(extQuery) extQuery = select * 从 table 名称到输出文件 '????'

Get path from VBscript variable to use with obj.sql(extQuery) extQuery = select * from table name into outfile '????'

我有这段代码,我需要从 VBScript 变量中检索路径并将其与 mysql 查询一起使用。

set fso = WScript.CreateObject("Scripting.FileSystemObject")
Mypath = fso.GetAbsolutePathName(".")
Fullpath = fso.buildpath(Mypath,"test.txt")

然后在代码的后面我需要启动一个查询:

obj.sql(extQuery)

extQuery = "select * from table_name into outfile '?????'.....

我需要做什么才能从我的变量中获取路径并在查询中使用它? 希望有人能给我举个例子。 谢谢!

您使用字符串连接

obj.sql(extQuery)

extQuery = "select * from table_name into outfile '" & Fullpath  &  "'....


extQuery = "SELECT *  INTO OUTFILE '" & Fullpath   & "'
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
  FROM table_name ;".

您还必须添加

 Fullpath = Replace(Fullpath , "\", "/") 

因为 \ 是 mysql

中的转义参数