Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    10

    Unanswered: 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

  2. #2
    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.

  3. #3
    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 &"#"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •