How can I compare dates ? For example, I want to delete item IDs that have dates before or equal the current date, i.e
if rs("Date" <= Date then
rs.Delete
What is the correct code(condition) to compare dates?
You could actually handle this in a seperate SQL statement so that you would not have to loop through all of the records yourself doing the date check. Something like:
Code:
sqlStr = "DELETE FROM TableName WHERE DateFieldName <= '" & FormatDateTime(Now,2) & "'"
Then you could just execute this with an open connection. The advantage of moving this to the database to do the work is that it is going to handle the deletions faster than doing them one record at a time directly in your ASP script.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.