Avatar of legacyhousing
legacyhousing

asked on 

Import CSV & parse into multi dimensional Array

I have been working on this old school ASP script and variations of for about 10 hours now, so thanks in advance for any and all the help!

I am pulling a remote CSV file from webserver A, and get it into a multidimensional array for display on webserver B and then input the data from the CSV into a SQL table....

Right now I got it pulling the data into an array, but how do I go about parsing the data and inputting it into SQL.

Help!


<%
 ' Functions
 Function GetURL(str_URL)
  Set obj_XMLHTTP = Server.CreateObject ("MSXML2.ServerXMLHTTP.3.0") 
  obj_XMLHTTP.Open "GET", str_URL, False, "", "" 
  obj_XMLHTTP.Send()
  While obj_XMLHTTP.readyState <> 4
   obj_XMLHTTP.waitForResponse(8000)
  Wend
  If Err.Number = 0 Then
   ' Response.Write("Status = " & obj_XMLHTTP.Status & "<br>")
   If obj_XMLHTTP.Status = 200 Then
	str_GetURL = obj_XMLHTTP.ResponseText
   Else
	 str_GetURL = "Bad URL"
   End If
  Else
   str_GetURL = "Bad URL"
  End If 
  Set obj_XMLHTTP = Nothing 
  GetURL = str_GetURL
 End Function
%>
<%
 str_URL = "http://www.legacyhousingltd.com/consignment/RFID/alertlist.csv"
 str_Text = GetURL(str_URL)
%>
<%
 
 ary_Text = Split(str_Text,vblf)
 For int_Counter = 0 TO UBound(ary_Text)
  Response.Write("[Line " & int_Counter & "]&nbsp;" & ary_Text(int_Counter) & "<br>")
 Next
%>

Open in new window

Scripting LanguagesASP

Avatar of undefined
Last Comment
legacyhousing

8/22/2022 - Mon