Based on the AC database, we have to update the display times of the database to the database every time. However, it turns out that a conflict error will be reported when the online traffic reaches 140. The background is rewritten to the following method and put into the application. Every n minutes or one of the banner is displayed and triggered to update the database. Practice has proved that the efficiency is greatly improved. Some Code that has been tested and tested in the past does not need to be used. Paste it slowly. Create a table using the code. And background.
Call bannerdisplay ()
Sub bannerdisplay ()
Dim arrbanner, arrlen, bannerdata, prvdbstate
Bannerdata = Application ("bannerdata ")
Arrlen = ubound (bannerdata)
If arrlen = 0 then
Response. Write "this ad space has no data"
Exit sub
Else
Dim B
Randomize
B = int (arrlen * RND ))
If bannerdata (B, 7) = false then
Response. Write "<a href = 'banenrgo. asp? Id = "& bannerdata (B, 0) &" 'target = '_ blank'> </a>"
Else
Response. Write (bannerdata (B, 6 ))
End if
If application ("bannerdata") (B, 5)-bannerdata (B, 4)> 1 then
If dbstate = false then
Dbopen ()
Prvdbstate = true
End if
Dim CS
Conn. execute ("Update [ad_banner] Set distimes =" & bannerdata (B, 5) + 1 & ", enddate = now, hasover = true where ADid =" & bannerdata (B, 0 ))
Set cs = server. Createobject ("zkxp. Cash ")
Set CS. Conn = Conn
Application. Lock ()
CS. loadbannerdata
Application. Unlock ()
Set cs = nothing
'Response. Write "<B> reload </B> <br>"
Else
Bannerdata (B, 5) = bannerdata (B, 5) + 1
Application. Lock ()
'Response. Write "<br> addoneid =" & bannerdata (B, 0) & "<br>"
'Response. write "display ap =" & Application ("bannerdata") (B, 5) & "arr =" & bannerdata (B, 5) & "<br>"
Application ("bannerdata") = bannerdata
'Response. Write "displayed after saving ap =" & Application ("bannerdata") (B, 5) & "<br>"
Application. Unlock ()
End if
If datediff ("N", application ("bannerdatasavedate"), now)> = sbdtdif then the variable sbdtdif is defined in userbin.
Application. Lock ()
Application ("bannerdatasavedate") = now
Application. Unlock ()
Dim I
If dbstate = false then
Dbopen ()
Prvdbstate = true
End if
For I = 0 to ubound (Application ("bannerdata")-1
Conn. execute ("Update [ad_banner] Set distimes =" & Application ("bannerdata") (I, 5) & "where ADid =" & Application ("bannerdata") (I, 0 ))
Next
End if
End if
If prvdbstate = true then dbclose ()
Bannerdata = NULL
End sub