%
Function QuoteOfDay()
'This is not a critical part of the app
'so if an error occurs - just ignore it
On Error Resume Next
Dim rsQuotes, cnQuotes
Dim iRandom
Dim iRecords
Dim lQuote, lAuthor
Set rsQuotes = Server.CreateObject("ADODB.RecordSet")
With rsQuotes
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open "SELECT * FROM QUOTES;", DSN
iRecords = .RecordCount
RANDOMIZE
iRandom = INT(iRecords * RND)
.Move iRandom
If Not .BOF or Not .EOF Then
lQuote = .Fields("Quote")
lAuthor = .Fields("Author")
End If
.Close
End With
If lQuote = "" Then
lQuote = "I am too tired to quote today"
lAuthor = "Brian Gillham"
End If
Response.Write("")
Response.Write("(" & iRandom + 1 & "-" & iRecords & ") " & lQuote)
Response.Write("")
Response.Write("")
Response.Write("")
Response.Write("(" & lAuthor & ")")
Response.Write("")
Response.Write("")
Set rsQuotes = Nothing
Set cnQuotes = Nothing
End Function
%>