Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

sql question

Options
  • 04-01-2004 4:20pm
    #1
    Registered Users Posts: 2,621 ✭✭✭


    I'm trying to delete rows from two dbs, using ASP.NET and VB and an access db. I want to delete rows where the lastlogindate is 60 days previous to the current date. Any ideas?


    Dim queryString As String = "DELETE FROM users, CCard WHERE users.userid = ccard.id and LastLogindate < datetime.now"


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Is datetime.now an Access function? Maybe the code should be
    Dim queryString As String = "DELETE FROM users, CCard WHERE
     users.userid = ccard.id and LastLogindate < " & datetime.now()
    


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    I don't think Access allows you to delete from two tables with one query. I know its definitely not part of the SQL standards.

    jc


  • Registered Users Posts: 437 ✭✭Spunj


    Far as I remember, Access allows Cascading deletes so all you have to do is delete the row from the parent table (users) and the corresponding child row will also be deleted.

    You need to set up a Primary/Foreign Key relationship and theres a checkbox there which lets you specify whether or not to use Cascading deletes/updates.


Advertisement