I would like to do a match on IP addresses in a returned recordset but would like to have a separate file with all the different records to be matched (not using the db)
If string_IPaddress = "list of IPs in a file" then...
You will need to open the text file using FSO and read line by line:
Code:
set fso = Server.Createobject("Scripting.FileSystemObject")
path = "c:\temp\ipAddress.txt"
set file = fso.opentextfile(path, 1)
do until file.AtEndOfStream
If string_IPaddress = file.ReadLine then
Response.write("<br> string_IPaddress = " & string_IPaddress & "<br>")
end if
loop
file.close
set file = nothing
set fso = nothing
Ah, I forgot, it's a CSV file. You will have to read the whole file and split it out to an array, then loop through this array.
Code:
arrayIP = Split( file.ReadAll, ", " )
for i = LBound(arrayIP) to UBound(arrayIP)
If string_IPaddress = trim(arrayIP(i)) then
Response.write("<br> string_IPaddress = " & trim(arrayIP(i)) & "<br>")
end if
next
use a ADO file connection? and access the CSV as a recordsource
see the FAQ section.
DreX
aKa - Robert if all else fails, light it on fire and do the happy dance! " I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.