I am designing a quote rotator for a webpage. It will be built in Visual Basic as an ActiveX Dll (COM Object) and then registered on the remote server. Then it is called invisibly when the page is executed (note: this is server-side not client-side).
However I need it to be a lot, lot faster.
Here is the code
The database is SQL server 7, webserver IIS4 and OS NT4. Connected via ODBC.Code:Public Function Hit(DSN)
Dim Connection, Recordset
Const adOpenForwardOnly = 0
Const adLockOptimistic = 3
Set Connection = CreateObject("ADODB.Connection")
Set Recordset = CreateObject("ADODB.Recordset")
Connection.ConnectionString = "dsn=" & DSN
Connection.Open
Recordset.MaxRecords = 1
Recordset.Open "SELECT * FROM Quotes ORDER BY [LastShown]", Connection, adOpenForwardOnly, adLockOptimistic
Recordset("QuoteDisplayed") = Recordset("QuoteDisplayed") + 1
Recordset("LastShown") = Now
Quote = Recordset("Quote")
Recordset.Update
Recordset.Close
Set Recordset = Nothing
Connection.Close
Set Connection = Nothing
Hit = Quote
End Function
