







|
 |


This function accepts a connection object and an SQL string and returns a .getRows array. The ObjDispose routine
referred to in the function below can be found here.
If you need help understanding .GetRows (why to use it, how to use it, what it is), Michael Brinkley has written a tutorial
here (opens in new window).
<%
Function ArrayFromSQL( _
ByRef objConn, _
ByVal strSQL _
)
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
If not objRS.EOF then
ArrayFromSQL = objRS.GetRows
End If
Call ObjDispose(objRS, True, True)
End Function
strSQL = "Select Field1 FROM table1"
arrResults = ArrayFromSQL(objConn, strSQL)
Call objDispose(objConn, True, True)
%>
Back to Code Listing |
Homepage
|
 |
 |