I am hoping someone can assist me with this. The application is rather simple in that it records driver information/stats on a weekly basis and allows for monthly analysis over several months. When it starts up it checks for records that are old and no longer relevant - these are deleted.
You will see that it does a count before and after the delete. I get no errors and the logs show the dates correctly but the record count at the end is the same as before. I also don't get a "failed to delete" log.
I thank you in advance for any suggestions
You will see that it does a count before and after the delete. I get no errors and the logs show the dates correctly but the record count at the end is the same as before. I also don't get a "failed to delete" log.
I thank you in advance for any suggestions
B4X:
Dim RemovalCursor As ResultSet
RemovalCursor = DB.ExecQuery("SELECT * FROM TotRecord Order By TotDate")
Log("Total Records for deletion Check = "&RemovalCursor.RowCount)
Do While RemovalCursor.NextRow
Dim RecordDated As String = RemovalCursor.GetString("TotDate")
If RecordDated < RemovalDate Then
Log(DateTime.Date(RecordDated)&" Older Than "&DateTime.Date(RemovalDate)&" Will Be deleted")
Try
DB.ExecNonQuery2("Delete From LogRecord where LogDate = ?", Array As Object(RecordDated))
Catch
Log("Failed to delete Record")
End Try
End If
Loop
RemovalCursor.Close
' Count Remaining Records
Dim RemovalCursor As ResultSet
RemovalCursor = DB.ExecQuery("SELECT * FROM TotRecord Order By TotDate")
Log("Total Records After Deletion = "&RemovalCursor.RowCount)
RemovalCursor.Close
' End Count