I have a .asp page which selects data from a database using an SQL statement and an ODBC connection.
I need to be able to open a text file, or create it if it doesn't exist, and write data to that text file, one line at a time. I am more familiar with VB. In VB I would have done this:
wFile = 1
Open "C:\temp\myfile.txt" For Output As wFile
Print #wFile, strDatabaseLine
Print #wFile vbCrLf
I would put this in a Do-While Loop Until the Database data was finished. This code doesn't work in VBS. I get an error as follows:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/create.asp, line 33
Open "C:\Temp\myfile.txt" For Output As wFile
--------------------------^
Obviously I'm doing something wrong. Can anyone tell me how to do this??
Thanks in advance.
Cheers
hummer010
I need to be able to open a text file, or create it if it doesn't exist, and write data to that text file, one line at a time. I am more familiar with VB. In VB I would have done this:
wFile = 1
Open "C:\temp\myfile.txt" For Output As wFile
Print #wFile, strDatabaseLine
Print #wFile vbCrLf
I would put this in a Do-While Loop Until the Database data was finished. This code doesn't work in VBS. I get an error as follows:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/create.asp, line 33
Open "C:\Temp\myfile.txt" For Output As wFile
--------------------------^
Obviously I'm doing something wrong. Can anyone tell me how to do this??
Thanks in advance.
Cheers
hummer010