Hi,<BR><BR>I want to increment throught a record set to call a new piece of data every 24 hrs from the db, which is to be added to my default page. <BR><BR>I spoke to bill about this a while ago and so far the method i decided on was caching. I set the page cache for 24hrs and then when the page is next called after this time it is re-cached using the latest record. To do this i think a variable must be incremented i chose &#039;x&#039; this is incremented to index through the recordset for the next record. <BR><BR>Can i simply add x = x+1 when the cache is re done and use this variable in the recordset? If so I am not sure where to place this x= x+1. At the moment I intialise X = 1 but can&#039;t figure out where it should be incremented. Places I tried didn&#039;t work is this because it can&#039;t be done or because i&#039;m clueless. Obviously there is more to this i.e. when x exceeds the number of records but I figured i&#039;d work that problem out next.<BR><BR>The code from the page is below.<BR><BR>&#060;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&#062;<BR>&#060;%const nCacheMins = 1440 &#039;update cacce every 24 hours<BR>call subCacheCheck(nCacheMins)<BR> x = 1 &#039;the variable i wish to increment with each update of the cache<BR>&#039;<BR>&#039; This enables automatic time-based per-page caching.<BR><BR><BR><BR>sub subCacheCheck(nMins)<BR><BR> &#039; if nocache param is set to 1, this code is all skipped!<BR> if request("nocache") = "1" then exit sub<BR> &#039; do we have a cached version of this page less than (x) minutes old?<BR> if fnCacheFresh(nMins) then<BR> &#039; yes ... redirect user to our cached HTML and terminate execution<BR> Server.Transfer(fnCacheFilename)<BR> else<BR> &#039; no ... cache the current HTML to a file, and continue execution<BR> call subCachePage()<BR> <BR> end if<BR>end sub<BR><BR><BR>&#039;<BR>&#039; retrieves value of current URL<BR>&#039; "/default.asp?id=3&move=up"<BR>&#039;<BR>function fnCacheURL<BR> dim sQueryString<BR> sQueryString = Request.ServerVariables("query_string")<BR> &#039; get rid of our internal params! <BR> sQueryString = replace(sQueryString, "&nocache=1", "")<BR> sQueryString = replace(sQueryString, "&recache=1", "")<BR> sQueryString = replace(sQueryString, "nocache=1", "")<BR> sQueryString = replace(sQueryString, "recache=1", "") <BR> if sQueryString = "" then<BR> fnCacheUrl = Request.ServerVariables("URL") <BR> else<BR> fnCacheUrl = Request.ServerVariables("URL") & "?" & sQueryString<BR> end if<BR>end function<BR><BR><BR>&#039;<BR>&#039; determine if page we are about to display has<BR>&#039; cached version created in last nMinutes<BR><BR>&#039;I THOUGHT I SHOULD ADD THE X + X +1 in this part of the code<BR>&#039;<BR>function fnCacheFresh(nMinutes)<BR> dim dLastUpdated <BR> &#039; retrieve app var for current URL<BR> dLastUpdated = Application(fnCacheURL)<BR> &#039; if there is no date, or user has requested recache, cache is invalid<BR> if dLastUpdated = "" or request("recache") = "1" then<BR> fnCacheFresh = false<BR> <BR> else<BR> <BR> fnCacheFresh = (DateDiff("n", dLastUpdated, Now()) &#060; nMinutes) <BR><BR> <BR> end if <BR>end function<BR><BR><BR>&#039;<BR>&#039; grab HTTP:// data from specified URL into a giant string<BR>&#039;<BR>function fnCacheGetHTML(sURL)<BR> dim oXML<BR> set oXML = Server.CreateObject("MSXML2.ServerXMLHTTP") <BR> on error resume next<BR> oXML.Open "GET", sURL, False<BR> oXML.Send<BR> fnCacheGetHTML = oXML.responsetext<BR>end function<BR><BR><BR>&#039;<BR>&#039; turn current URL into a relatively safe filename<BR>&#039; input: "/default.asp?id=3&move=up"<BR>&#039; output: "cache__default_asp_id=3_move=up.htm"<BR>&#039;<BR >function fnCacheFilename()<BR> dim sTemp<BR> sTemp = fnCacheURL<BR> sTemp = Replace(sTemp, ".", "")<BR> sTemp = Replace(sTemp, "/", "")<BR> sTemp = Replace(sTemp, "&", "")<BR> sTemp = Replace(sTemp, "?", "")<BR> sTemp = Replace(sTemp,"=", "")<BR> <BR> sTemp = sTemp & ".htm" <BR> fnCacheFilename = sTemp<BR>End Function<BR><BR><BR>&#039;<BR>&#039; write provided HTML to cache file<BR>&#039;<BR>function fnCacheWriteFile(sText)<BR> if sText = "" then exit function<BR> on error resume next<BR> dim objFSO, objFile<BR> set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR> set objFile = objFSO.OpenTextFile(Server.MapPath(fnCacheFilename ), 2, True, 0) &#039; write-only, overwrite, textfile<BR> objFile.Write sText<BR> objFile.Close<BR> fnCacheWriteFile = (err = 0) <BR><BR>end function<BR><BR><BR>&#039;<BR>&#039; cache current page HTML to file<BR>&#039;<BR>sub subCachePage()<BR> dim sURL<BR> dim sHTML<BR> dim sCurrentURL<BR> <BR> sCurrentURL = fnCacheURL <BR> <BR> &#039; Be SURE to include the nocache=1 param, or suffer the wrath of the infinite recursion gods!<BR> sURL = "http://" & Request.ServerVariables("SERVER_NAME") & ":" & _<BR> Request.ServerVariables("SERVER_PORT") & _<BR> sCurrentURL <BR> if instr(sURL, "?") &#062; 0 then<BR> sURL = sURL & "&nocache=1"<BR> else<BR> sURL = sURL & "?nocache=1"<BR> end if<BR> <BR> &#039; loopback and rip the HTML for the current page <BR> sHTML = fnCacheGetHTML(sURL)<BR> <BR> &#039; write ripped HTML to file<BR> if fnCacheWriteFile(sHTML) then <BR> &#039; mark page cache as valid as of now<BR> Application.Lock<BR> Application(sCurrentURL) = Now()<BR> else<BR> &#039; mark page cache invalid as of now<BR> Application.Lock<BR> Application(sCurrentURL) = ""<BR> <BR> end if<BR> Application.Unlock<BR> <BR>end sub<BR><BR>%&#062;<BR><BR> <BR><BR><BR>&#060;!--#include file="Connections/widget.asp" --&#062;<BR>&#060;%<BR>Dim Recordset1__MMColParam<BR>Recordset1__MMColParam = x<BR>If (Application("x") &#060;&#062; "") Then <BR> Recordset1__MMColParam = Application("x") <BR>End If<BR>%&#062;<BR>&#060;%<BR>Dim Recordset1<BR>Dim Recordset1_numRows<BR><BR>Set Recordset1 = Server.CreateObject("ADODB.Recordset")<BR>Recordse t1.ActiveConnection = MM_widget_STRING<BR>Recordset1.Source = "SELECT * FROM [daily update] WHERE fac_counter = " + Replace(Recordset1__MMColParam, "&#039;", "&#039;&#039;") + ""<BR>Recordset1.CursorType = 0<BR>Recordset1.CursorLocation = 2<BR>Recordset1.LockType = 1<BR>Recordset1.Open()<BR>