Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to change script to delete record after on year.

Reply
Thread Tools

How to change script to delete record after on year.

 
 
chug
Guest
Posts: n/a
 
      10-28-2005
How do I change this script to delete records after they are one year
old?

RSa.MoveNext
Loop

set fso = Nothing
RSa.Close

' Then, Delete old notifications

sql = "DELETE FROM residential WHERE enddate < #" &
DateAdd("d",-365,NOW()) & "#"
RSa.Open sql, "DSN=Auction"

sql = "DELETE FROM residential WHERE enddate < #" &
DateAdd("d",-365,NOW()) & "#"
RSa.Open sql, "DSN=Auction"

sql = "SELECT * FROM residential WHERE 1 = 1"
if Request("NewHomes") <> "" then
sql = sql & " AND NewHome = 1"
end if
if Request("Foreclosure") <> "" then
sql = sql & " AND Foreclosure = 1"
end if
sql = sql & " ORDER BY ViewingDate DESC"

On Error Resume Next
RS.Open sql, "DSN=Auction"
If err.number <> 0 Then

Response.Write err.description & "<br>"
Response.Write sql
Else%>


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      10-28-2005
chug wrote on 28 okt 2005 in microsoft.public.inetserver.asp.general:

> sql = "DELETE FROM residential WHERE enddate < #" &
> DateAdd("d",-365,NOW()) & "#"
>


sql = "DELETE FROM residential WHERE enddate < #" &
DateAdd("yyyy",-1,NOW) & "#"

Perhaps. depending on your engine, also:

sql = "DELETE FROM residential WHERE enddate <
DateAdd("yyyy",-1,NOW)"


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
You cannot add or change a record because a related record is required in table 'lok" André ASP .Net 0 06-25-2006 01:30 PM
You cannot add or change a record because a related record is required in table 'lok" André ASP .Net Web Controls 0 06-25-2006 01:30 PM
how to refresh screen after delete a record J ASP .Net 2 10-27-2004 06:52 PM
XP wont let me delete program even after change file from read only? Rachel and Steve NZ Computing 8 05-25-2004 09:29 AM



Advertisments