Results 1 to 2 of 2

Thread: VBscript arrays

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Unhappy

    Can one create an array with vbscript and if so, how??

    What I want to do is select a field from a table and populate the array with the result of all the records which was returned, close the connection and recordset and then later in my HTML populate a dropdown menu with the results in the array.

    This way I save on open connections/recordsets etc.

    Any help??

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Code:
    Dim arrMyArray
    Dim strSQL
    Dim cn
    Dim rs
    
    Set cn = Server.CreateObject("ADODB.Connection")
    cnCn.ConnectionString = "Provider=SQLOLEDB;Server=" & SVR & ";Database=" & DB & ";UID=" & USER & ";Pwd=" & PWD & ";"
    cnConn.Open
    strSQL = "Select * from Table"
    Set rs = cn.Execute strSQL
    arrMyArray = rs.GetRows
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing

    This creates a two dimensional array:
    arrMyArray(columns, rows)

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

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



Click Here to Expand Forum to Full Width