<%@LANGUAGE=VBSCRIPT%> phrogz' list of mp3s <% Dim DSNFile DSNFile = "CSV.dsn" ' Let's now dynamically retrieve the current directory Dim scriptDir scriptDir = Request.ServerVariables("SCRIPT_NAME") scriptDir = StrReverse(scriptDir) scriptDir = Mid(scriptDir, InStr(1, scriptDir, "/")) scriptDir = StrReverse(scriptDir) ' Time to construct our dynamic DSN Dim sPath, sDSN sPath = Server.MapPath(scriptDir) & "\" sDSN = "FileDSN=" & sPath & DSNFile & ";DefaultDir=" & sPath & ";DBQ=" & sPath & ";" ' Building Data Connection Dim Conn, rs Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open sDSN Dim sql sql = "SELECT * FROM mp3s.csv ORDER BY Artist,Album,SongTitle" set rs = conn.execute(sql) %> <% Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(Request.ServerVariables("PATH_TRANSLATED")) lastMod = f.DateLastModified %> Last modified <%=FormatDateTime(lastMod,vbLongDate)%> <% lastArtist="" lastAlbum = "" While not rs.EOF curArtist = rs("Artist") if curArtist <> lastArtist then if lastArtist <> "" then%> <% end if lastArtist = curArtist songsTxt = "" sizesTxt = "" lastAlbum = "" end if curAlbum = rs("Album") if curAlbum <> lastAlbum AND NOT (curAlbum = "Misc." AND lastAlbum = "") then if lastAlbum <> "" then songsTxt = songsTxt & "" end if songsTxt = songsTxt & ""&curAlbum&"
" sizesTxt = sizesTxt & "
" lastAlbum = curAlbum end if songsTxt = songsTxt & rs("SongTitle") & "
" sizesTxt = sizesTxt & rs("SongSize") & "
" rs.MoveNext Wend%>
<%=lastArtist%> <%=songsTxt%> <%=sizesTxt%>
<%=lastArtist%> <%=songsTxt%> <%=sizesTxt%>
<% 'Close our recordset and connection rs.close set rs = nothing conn.close set conn = nothing %>