<%
dim a, i, j, cn, strSQL
cn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.mappath("/aspemporium/mydata.mdb") & ";"
strSQL = "SELECT exampleName, exampleDesc FROM examples ORDER BY exampleName;"
a = RecSet(cn, strSQL)
If IsNull(a) Then
' no results found
response.write "<P STYLE=""font-size:10pt;"">" & vbCrLf
response.write "No Results Found!" & vbCrLf
response.write "</P>" & vbCrLf
Else
response.write "<P STYLE=""font-size:10pt;"">" & vbCrLf
For j = 0 to ubound(a, 2)
For i = 0 to ubound(a, 1)
response.write a(i, j) & vbCrLf
response.write "<BR>" & vbCrLf
Next
response.write "<BR>" & vbCrLf
Next
response.write "</P>" & vbCrLf
End If
%>
<%
Private Function RecSet(byVal connstring, byVal SQL)
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
Dim DebugRs, Tmp
Set DebugRs = Server.CreateObject("ADODB.Recordset")
With DebugRs
.CursorType = adOpenStatic
.CursorLocation = adUseServer
.LockType = adLockReadOnly
.ActiveConnection = connstring
.Source = SQL
.Open
If .BOF then
Tmp = Null
Else
Tmp = .GetRows()
End If
.Close
End With
Set DebugRs = Nothing
RecSet = Tmp
End Function
%>