B
Ben
Im writing a script that will get the last 7 days of information, more
specifically the points within those 7 days. What I have works some of
the time, but it doesn't work all of the time, if a user hasn't
entered anything for 7 days it crashes, thanks for any help.
------------------------------------------------------------------
i = 0
x = 7
'Create an ADO recordset object
Set rs_rufitPoints = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT points, actDate FROM tblActivity WHERE USER_ID = "&
ret_ID &" ORDER BY actdate DESC"
'Open the recordset with the SQL query
rs_rufitPoints.Open strSQL, adoCon
Do While NOT rs_rufitPoints.EOF
intTotalRufitWeeklyPoints = 0
intTempRufitPoints = 0
tempDate = date() - i
tempDate1 = date() - x
Do While rs_rufitPoints("actDate") > tempDate1 and
rs_rufitPoints("actDate") <= tempDate
intRufitPoints = rs_rufitPoints("points")
intTempRufitPoints = intTempRufitPoints + intRufitPoints
rs_rufitPoints.MoveNext
Loop
If intTempRufitPoints >= 35 then
intTempRufitPoints = 35
End If
i = i + 7
x = x + 7
intTotalRufitPoints = intTotalRufitPoints + intTempRufitPoints
rs_rufitPoints.MoveNext
Loop
Response.Write("<br>Points Towards your RuFit Achievement
Levels</strong>")
Response.Write( intTotalRufitPoints )
------------------------------------------------------------------
specifically the points within those 7 days. What I have works some of
the time, but it doesn't work all of the time, if a user hasn't
entered anything for 7 days it crashes, thanks for any help.
------------------------------------------------------------------
i = 0
x = 7
'Create an ADO recordset object
Set rs_rufitPoints = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the
database
strSQL = "SELECT points, actDate FROM tblActivity WHERE USER_ID = "&
ret_ID &" ORDER BY actdate DESC"
'Open the recordset with the SQL query
rs_rufitPoints.Open strSQL, adoCon
Do While NOT rs_rufitPoints.EOF
intTotalRufitWeeklyPoints = 0
intTempRufitPoints = 0
tempDate = date() - i
tempDate1 = date() - x
Do While rs_rufitPoints("actDate") > tempDate1 and
rs_rufitPoints("actDate") <= tempDate
intRufitPoints = rs_rufitPoints("points")
intTempRufitPoints = intTempRufitPoints + intRufitPoints
rs_rufitPoints.MoveNext
Loop
If intTempRufitPoints >= 35 then
intTempRufitPoints = 35
End If
i = i + 7
x = x + 7
intTotalRufitPoints = intTotalRufitPoints + intTempRufitPoints
rs_rufitPoints.MoveNext
Loop
Response.Write("<br>Points Towards your RuFit Achievement
Levels</strong>")
Response.Write( intTotalRufitPoints )
------------------------------------------------------------------