doorbreaker
Programmer
Hi,
have some code in a vbs file that should drag all records out of a db and then spit them out into a csv file.
I run the file and no errors are thrown up but no csv file is made. Any ideas - code below....
I have checked the permissions on the folder.
Any help appreciated.
Chris
have some code in a vbs file that should drag all records out of a db and then spit them out into a csv file.
I run the file and no errors are thrown up but no csv file is made. Any ideas - code below....
I have checked the permissions on the folder.
Any help appreciated.
Chris
Code:
on error resume next
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.cursorlocation=3
oconn.Open "driver={sql server};server=xxx.xxx.xxx.xxx;database=mydb;uid=myuid;pwd=mypwd"
strSQL = "select * from productmaster"
Set oRS = objconn.Execute(strSQL)
dim oFSO, oFile,oField
dim strOutput
set oFSO = server.createobject ("scripting.filesystemobject")
set oFile = oFSO.createtextfile("c:\csv\kelkoo.csv",true)
do until oRS.eof
for each oField in oRS.fields
stroutput = stroutput & ofield.value & ","
next
stroutput = left(stroutput,len(stroutput)-1)
ofile.writeline stroutput
ors.movenext
loop
ofile.close
set oFile = nothing
set oFSO = nothing