Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 something related to dates
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

quince
Junior Member

Canada
103 Posts

Posted - 15 March 2005 :  15:00:52  Show Profile
heloo everyone
am facing a problem in deleting a record from a table where the record had been posted for more than 7 days .
the codes below are some tries that i have done but it didnot work , it give "type mismatch"

while not rs.eof
sql1=" delete from post where date < = (select * from post where ("& date() &" - date) >= 7)"
Set rs = cn.Execute(sql1)
rs.movenext
wend

and

while not rs.eof

sql1=" delete from post where ("& date() &" - date) >= 7)"
Set rs = cn.Execute(sql1)

rs.movenext
wend


waiting for replies and thanx in advance
quince

Doug G
Support Moderator

USA
6493 Posts

Posted - 15 March 2005 :  19:21:55  Show Profile
This makes no sense. What column does your WHERE operate on?

sql1=" delete from post where ("& date() &" - date) >= 7)"

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

quince
Junior Member

Canada
103 Posts

Posted - 18 March 2005 :  03:10:41  Show Profile
my WHERE operate on the date column. i want to delete from the database the records that had been inserted to the database from 7 days or more
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 18 March 2005 :  07:44:25  Show Profile
You need to rename your "date" column especially if you want to use VB Date functions.

You can try this
sql1 = "DELETE FROM POST WHERE DateDiff("d",Date,Renamed Date Column) > 7"

There's a number of ways to get the same results.
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp


    _-/Cripto9t\-_
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07