gsc123
Programmer
- Jan 24, 2008
- 197
Hello,
I'm trying to append to the begining of the loop the file names taken from the directory, I open a csv file, then disply contents but what to parse each filename to column 1 and 3 of the csv data, is this possible?
I'm trying to append to the begining of the loop the file names taken from the directory, I open a csv file, then disply contents but what to parse each filename to column 1 and 3 of the csv data, is this possible?
Code:
<%
on error resume next
Dim fs,i
set fso = server.CreateObject("Scripting.FileSystemObject")
Server.ScriptTimeout = 3600
dim foldername
foldername = "escort"
dim sitename
dim width
dim sizeimg
set rs = Server.CreateObject("ADODB.recordset")
Dim sConn, sSource, sResults
sConn = "DRIVER={Microsoft Text Driver (*.txt; *.csv)};" & "DefaultDir=" & "C:\Inetpub\[URL unfurl="true"]wwwroot\parse"[/URL] & ";Extensions=asc,csv,tab,txt"
sSource = "Select * FROM [ESCORTLIST.csv]"
rs.Open sSource, sConn, adOpenKeyset
sitename = "[URL unfurl="true"]www.gsc1ugs.pwp.blueyonder.co.uk"[/URL]
set f = fso.GetFolder("C:\Inetpub\[URL unfurl="true"]wwwroot\parse\adds\")[/URL]
str = "<TABLE>" &VBCrlf
str = str & " <TBODY>" &VBCrlf
str = str & "<TR>" &VBCrlf
width = 4
sizeimg = 50
i = 1
%><TABLE BORDER=1><TR><%
do until rs.EOF%>
<%for each x in rs.Fields%>
<TD><%Response.Write(x.value)%></TD>
<%next
rs.MoveNext%></BR></TR>
<%loop%>
</TABLE><%
'for each file in f.files
' str = str & "<TD><A href=""[URL unfurl="true"]http://"&sitename&"/adds/"&foldername&"/"&file.name[/URL] &" "" target=blank><IMG title="&file.name &" height="&sizeimg&" src=""[URL unfurl="true"]http://"&sitename&"/adds/"&foldername&"/"&file.name[/URL] &" "" width="&sizeimg&"></A></TD>" &VBCrlf
' if i = width then
' str = str & "</TR>" &VBCrlf
' i=0
' end if
' i = i + 1
'next
str = str & "</TBODY></TABLE>"
'response.write str
rs.Close
%>
[CODE]