Array for VB Script

Results 1 to 2 of 2

Thread: Array for VB Script

  1. #1
    Join Date
    Dec 1969

    Default Array for VB Script

    I found the following jscript code in an earlier post:<BR><BR>********************************<BR>R esponse.Write("var arr = new Array") <BR>var x = 0; <BR>while(!objRS.EOF) { <BR> Response.Write("arr[" + x + "] = &#039;" + objRS("value") + "&#039;") <BR> x++ <BR> objRS.movenext(); <BR>} <BR>********************************<BR><BR>Does anyone know what this would look like in vbscript, or maybe have an idea of what I need to do to run this on my asp page before the output to the browser? I&#039;m trying to save a list of ID values from a recordset to an array and this seemed like the way to go but I&#039;m not sure how to implement it. <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Array for VB Script

    Response.Write("var arr = new Array();" + vbcrlf)<BR>Dim x<BR>x = 0<BR>while not objRS.EOF<BR>Response.Write("arr[" & x & "] = &#039;" & objRS("value") & "&#039;;" & vbcrlf)<BR>x = x + 1<BR>objRS.movenext<BR>wend<BR><BR>the original will throw javascript error because of the lack of semi-colons and/or linebreaks in the javascript code that is written to the client. Why not just use JScript though? there are a lot of good reasons for it, as an article at explains.<BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts