Dim destination As String
Dim retcode As Long
Dim query as String
Dim outputStr as String
Dim filename as String
Dim columnDelimiter as String
''''
'''' Open the connection
connection = SQLOpen("DSN=SblTest",outputStr,prompt:=3)
'''' Execute the query
''''
query = "select * from customer"
retcode = SQLExecQuery(connection,query)
'''' Place the results of the previous query in the file named by
'''' filename and put the column names in the file as the first row.
'''' The field delimiter is %
''''
[NextPage]
filename = "c:\myfile.txt"
columnDelimiter = "%"
retcode = SQLRetrieveToFile(connection:=connection,destination:=filename, columnNames:=1,columnDelimiter:=columnDelimiter)
retcode = SQLClose(connection)
End Sub
文章来源于领测软件测试网 https://www.ltesting.net/