<% 'if session("ActiveSession") = "" then 'If no active login, sends back to login ' response.redirect "fb_mainframeset.asp" 'end if dim DB, RS, manager, lineup manager = request.querystring("manager") lineup = request.querystring("lineup") dim DB5, NextRecent, MostRecent set DB5 = server.createobject("DBEdit.DBAccessProcs") DB5.DSN="billnewman" 'Names data source DB5.TableName="Clubs" 'Names table set RS5 = DB5.GetRecord ("ClubID", manager) MostRecent = RS5("NextRecent") 'Gets current next most recent, to put to most set RS5 = nothing set DB5 = nothing dim DB2, RS2, x, count, y count = 0 'initialize x = 0 y = 0 set DB2 = server.createobject("DBEdit.DBAccessProcs") DB2.DSN="billnewman" 'Names data source DB2.TableName="Lineups" 'Names table set RS2 = DB2.GetRecords("no","no") if not(RS2.EOF) then Do Until RS2.EOF count = count + 1 'Counts total records RS2.MoveNext Loop end if set RS2 = nothing dim temp(50) 'Array to hold lineup numbers temporarily set DB = server.createobject("DBEdit.DBAccessProcs") DB.DSN="billnewman" 'Names data source DB.TableName="Lineups" 'Names table, to get previous most recent lineup set RS = DB.GetRecords ("no","no") 'Retrieves all records in table if not(RS.EOF) then Do Until RS.EOF x = x + 1 'Counts number of lineups per current manager if cint(RS("ClubID")) = (cint(manager)) then y = y + 1 'Counts number of lineups per current manager temp(y) = cint(RS("LineupID")) 'temporarily writes clubID of each lineup in database for that owner response.write "temp y is: " & temp(y) end if RS.movenext loop end if If temp(y) > 0 then NextRecent = temp(y-2) 'Grabs previous most recent else NextRecent = manager 'Default lineup if no other available, 1-12 end if response.write "NextRecent is" & NextRecent dim conn3, rs3, sql3 set conn3 = server.createobject("adodb.connection") sql3 = "update Clubs set MostRecent='" & lineup & "' where ClubID =" & request.querystring("manager") 'Updates most recent lineup in Clubs conn3.open "billnewman" conn3.execute sql3 conn3.close set conn3 = nothing dim conn4, rs4, sql4 set conn4 = server.createobject("adodb.connection") sql4 = "update Clubs set NextRecent='" & NextRecent & "' where ClubID =" & request.querystring("manager") 'Updates most recent lineup in Clubs conn4.open "billnewman" conn4.execute sql4 conn4.close set conn4 = nothing dim DB6 set DB6 = server.createobject("DBEdit.DBAccessProcs") DB6.DSN="billnewman" 'Names data source DB6.TableName="Lineups" 'Names table DB6.DeleteRecord "LineupID", lineup set DB6 = nothing %>