|
Hi IRON-HQ,
It sounds as though the initial rsCommon recordset contains 0 records. This could be the result of a malformed SQL statement. Not sure if this is beyond the scope of your abilities or not, but I would try the following to debug it. Add only the lines of code indicated between the dashed lines below to the /admin/batch_delete_posts.asp file:
'Initalise the strSQL variable with an SQL statement to get the topic from the database strSQL = "SELECT " & strDbTable & "Topic.Topic_ID, " & strDbTable & "Topic.Poll_ID FROM " & strDbTable & "Topic " If intForumID = 0 Then strSQL = strSQL & "WHERE " & strDbTable & "Topic.Last_entry_date < " & strDatabaseDateFunction & " - " & intNoOfDays Else strSQL = strSQL & "WHERE (" & strDbTable & "Topic.Last_entry_date < " & strDatabaseDateFunction & " - " & intNoOfDays & ") AND (" & strDbTable & "Topic.Forum_ID=" & intForumID & ")" End If If intPriority <> 4 Then strSQL = strSQL & " AND (" & strDbTable & "Topic.Priority=" & intPriority & ")" strSQL = strSQL & ";"
-------------------------------------------------- ' ADD THESE TWO LINES OF CODE. ' Display the resulting SQL statement. Response.Write "strSql = " & strSql & "<br>" ' Stop ASP processing. Response.End --------------------------------------------------
'Query the database rsCommon.Open strSQL, adoCon
|
This will cause the server to write the strSql variable to the screen and stop execution so you can look at the SQL statement that is to be executed. You can then open a view to the SQL table via SQL Enterprise Manager and try to execute the SQL statement via that interface which may provide additional debug information if there is a problem with it. If still no success paste the SQL statement in to a post here so we can have a look at it. Also, visually confirm that the Last_Entry_Date field in the Topic table got created as a date data type.
When I'm having trouble with SQL execution, I use the above method and then go to either Access or SQL Enterprise Manager and sort the data to visually confirm that there are records that should be getting deleted. If there are, then something's wrong with the SQL statement.
I'm not a SQL expert but I have found in some instances that if I use the BETWEEN expression instead of the explicit <> operators, I have a greater degree of success in testing date ranges. Here's an http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_7o6m.asp - MSDN Article which talks about the BETWEEN expression. Good Luck. :)
------------- Take Care,
Shatz
Pro Racing Series Developer/Administrator
http://www.ProRacingSeries.com - http://www.ProRacingSeries.com
|