The page consists of the following code that runs in the from the onadcreated event of an adrotator control. Everything works but the problem is that after a certain amount of time and meta refreshes I get an error "that says too many client tasks". Thats all it says. Looking that up I find that its when the database gets called to many times simultaneously, but I dont see how that could be a problem as I am closing it at the end of over snippet as you can see. I have pagestateview set to false and caching turned off as much as possible. I just dont understand what the hell is going on here.
Sub change_url(sender As Object, e As AdCreatedEventArgs)
Dim ad = Server.CreateObject("ADODB.Recordset")
'ad.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Inetpub\faat\Data\data.mdb;"
ad.ActiveConnection = "DSN=hotspot;"
ad.Source = "SELECT * FROM ad WHERE ad_type=1 ORDER by ad_impressions ASC"
ad.CursorType = 0
ad.CursorLocation = 2
ad.LockType = 1
ad.Open()
Dim Lowkey = ad.Fields.Item("ad_key").Value
Dim impress = CInt(ad.Fields.Item("ad_impressions").value) + 1
Dim lowupdate = Server.CreateObject("ADODB.Recordset")
Dim conn = Server.CreateObject("ADODB.Command")
conn.ActiveConnection = "DSN=hotspot;"
conn.CommandText = "UPDATE ad SET ad_impressions=" & impress & " WHERE ad_key = " & ad.Fields.Item("ad_key").Value
conn.CommandType = 1
conn.CommandTimeout = 0
conn.Prepared = true
conn.Execute()
e.NavigateUrl= ad.Fields.Item("ad_url").Value
e.ImageUrl = ad.Fields.Item("ad_image").Value
ad.Close()
End Sub
Sub change_url(sender As Object, e As AdCreatedEventArgs)
Dim ad = Server.CreateObject("ADODB.Recordset")
'ad.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\Inetpub\faat\Data\data.mdb;"
ad.ActiveConnection = "DSN=hotspot;"
ad.Source = "SELECT * FROM ad WHERE ad_type=1 ORDER by ad_impressions ASC"
ad.CursorType = 0
ad.CursorLocation = 2
ad.LockType = 1
ad.Open()
Dim Lowkey = ad.Fields.Item("ad_key").Value
Dim impress = CInt(ad.Fields.Item("ad_impressions").value) + 1
Dim lowupdate = Server.CreateObject("ADODB.Recordset")
Dim conn = Server.CreateObject("ADODB.Command")
conn.ActiveConnection = "DSN=hotspot;"
conn.CommandText = "UPDATE ad SET ad_impressions=" & impress & " WHERE ad_key = " & ad.Fields.Item("ad_key").Value
conn.CommandType = 1
conn.CommandTimeout = 0
conn.Prepared = true
conn.Execute()
e.NavigateUrl= ad.Fields.Item("ad_url").Value
e.ImageUrl = ad.Fields.Item("ad_image").Value
ad.Close()
End Sub