-
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??
-
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)