<%
Response.Buffer=True
'Define our ADO constants
const adOpenStatic = 3
const adLockOptimistic = 3
'----- Create and Open Connection
Set MyConnection = Server.CreateObject("ADODB.Connection")
MyConnection.ConnectionString = "DSN=bwsql;UID=user1044626;PWD=Ds5prg2kth"
MyConnection.Open
'----- Pick Ad from database
SQLBanners = "Select * from user1044626.Banners"
Set Banners = Server.CreateObject("ADODB.Recordset")
Banners.CursorType = adOpenStatic
Banners.LockType = adLockOptimistic
Banners.Open SQLBanners, MyConnection
Randomize Timer
Banners.Move Int(RND * CInt(Banners.RecordCount))
'----- Increment Shown field value
Banners("Shown") = Banners("Shown") + 1
Banners.Update
'----- Create and display Response
ImageString = " "
ResponseString = "" & ImageString & ""
Response.Write ResponseString
'----- Clean up memory
Banners.Close
MyConnection.Close
Set Banners=Nothing
Set MyConnection=Nothing
%>
 |
|