deleting old records

Results 1 to 2 of 2

Thread: deleting old records

  1. #1
    Join Date
    Dec 1969

    Default deleting old records

    Hello,<BR>I have a database field called EDate (text field) and records are added automatically according to the date record is added. the Db is now getting big and old messages can be flushed out. I hope to delete old messages past 14 days old automatically as the user enters so he will only see message in the last 14 days.<BR><BR>I cna&#039;t get this to work. I&#039;m having problems getting the &#060; to work in the SQL statement. Below is how I thought things should work and any help is appriciated.<BR><BR>&#060;%<BR>Set rs = Server.CreateObject("ADODB.Connection")<BR>CONN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("mydatabase.mdb") & ";"<BR><BR>Set rs = Server.CreateObject("ADODB.RecordSet")<BR>MySQL = "Delete * From messages Where Recipient=&#039;" & Session("CurrentUserName") & "&#039; and EDate &#060; &#039;" & DateAdd("d", -14, Date()) & "&#039;"<BR> MySQL, CONN<BR><BR>Conn.Close<BR>Set conn = nothing<BR>%&#062;<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: deleting old records

    Edate is a text field?<BR><BR>Probably have to call a date conversion function, don&#039;t know of one in access its convert or cast in sql server.<BR><BR>

Posting Permissions

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