If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SQL Delete Problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-03-04, 17:53
twooly twooly is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
SQL Delete Problems

I am trying to create a script that will show users online without using global.asa. I almost have it working besides one thing. I want my sql to delete entries in a table once an entry reaches a certain point. So here is what I have. My problem is it deletes everything in the table.
Suggesstions.

Here is the code:

strTimeout = 5
StrOnlineTimedout = dateadd("n",-strtimeout*60,onlinedate)

StrSql = "DELETE FROM active_users WHERE Last_Seen < '" & StrOnlineTimedout & "'"
adoCon.execute (StrSql)

I am using an access db and the column Last_Seen has a type "memo" and the form that the date entered into the column is 1/3/2004 2:40:17 PM using the now() function.

Thanks
Reply With Quote
  #2 (permalink)  
Old 01-03-04, 22:11
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Why are you using a memo datatype to represent date/time data ? This is probably causing your problem because it is doing an ascii comparison in the where clause.
Reply With Quote
  #3 (permalink)  
Old 01-03-04, 23:47
twooly twooly is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
got it figured out. I changed to date/time and changed the sql to this

StrSql = "DELETE FROM active_users WHERE Last_Seen < #" & StrOnlineTimedout &"#"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On