<%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit %> <% dim referer, refhttp ' Process form values if submitted referer = Request.ServerVariables("HTTP_REFERER") if(InStr(referer, "empeg_search.asp") = 0) then refhttp = referer end If %> Empeg Songs access from CSV This will allow you to search your CSV file from Emplode. Searching is not functioning yet but you can get the idea on how it will work by clicking 'Search'. <% ' Process form if (Request.Form("Submit") = "Search") Then Response.Write "" ' Set up constants Const ForReading = 1 ' Input OutPut Mode Const Create = False ' Declare local variables Dim FSO ' FileSystemObject Dim TS ' TextStreamObject Dim strLine ' local variable to store Line Dim strFileName ' local variable to store fileName Dim InfoArray, i ' storage array for information Dim type_emp, title, artist, genre, source, year, hold ' vars strFileName = Server.MapPath("empeg_db") ' Instantiate the FileSystemObject Set FSO = Server.CreateObject("Scripting.FileSystemObject") ' use Opentextfile Method to Open the text File Set TS = FSO.OpenTextFile(strFileName, ForReading, Create) If not TS.AtEndOfStream Then Do While not TS.AtendOfStream strLine = TS.ReadLine ' Read one line at a time InfoArray = Split(strLine, "," & chr(34)) type_emp = Replace(InfoArray(1), chr(34), "") ' type_emp = InfoArray(1) if (StrComp(type_emp, "tune") = 0) then ' Loop to display all CSV elements ' For i = 0 to UBound(InfoArray) ' Response.Write "" ' Next title = Replace(InfoArray(3), chr(34), "") artist = Replace(InfoArray(4), chr(34), "") genre = Replace(InfoArray(12), chr(34), "") source = Replace(InfoArray(13), chr(34), "") year = Replace(InfoArray(14), chr(34), "") ' if (StrComp(Request.Form("title"),title) = 0 ) then Response.Write "" Response.Write "" Response.Write "" ' end if end if loop End If ' close TextStreamObject and destroy local variables to relase memory TS.Close Set TS = Nothing Set FSO = Nothing Response.Write "
" ' Response.Write InfoArray(i) ' Response.Write "
" & type_emp & "" & title & "" & artist & "" Response.Write genre & "" & source & "" & year & "
" End if %>
Song Title:
Artist:
Album:
Year: