Folgendes Script ladet das entsprechende SQL Query in ein zweidimensionales Array, mit welchem danach weiter geartbeitet werden kann.

Funktion:

strConnection= “….”

Private Function QueryDB(DBQuery)
on error resume next
Const adOpenForwardOnly = 0, adOpenKeyset = 1
Const adOpenDynamic = 2, adOpenStatic = 3
Const adLockReadOnly = 1, adLockPessimistic = 2
Const adLockOptimistic = 3, adLockBatchOptimistic = 4
Const adUseServer = 2, adUseClient = 3
Set DebugRs = CreateObject(“ADODB.Recordset”)
With DebugRs
CursorType = adOpenStatic
CursorLocation = adUseServer
LockType = adLockReadOnly
ActiveConnection = strConnection
Source = DBQuery
Open
If BOF then
Tmp = Null
Else
Tmp = GetRows()
End If
Close
End With
Set DebugRs = Nothing
QueryDB = Tmp
end function

Beispiel:

result = querydb(“select * from tabelle”)
for i to ubound(result,2)
   response.write result(i,0) & result(i,1)
next

Share