Hi,

I am trying to delete all entries in a table that are older than 30
days. Here is my code in VB, can someone tell me how to fix this so
that it actually does the deletion? thank you

Private Sub clearEventLog()
Dim sql
Dim currentDateTime As String

Try
 currentDateTime = Month(Now()) & "/" & Day(Now()) & "/" & Year(Now())
& " " & Hour(Now()) & ":" & Minute(Now()) & ":" & Second(Now())
app.Events.Write("current date: " & currentDateTime)
            sql = "DELETE FROM TBLAPPLICATIONLOG WHERE DTMERROR < " &
currentDateTime - 30
            _dbAccess.executeDbCommand(sql)
        Catch ex As Exception
            onError("eventViewer.aspx.vb | clearEventLog() " &
ex.Message, ex)
 End Try
 End Sub

Reply via email to