I have a program using a SQLite database which needs to remove a row after it's expiration date is lower than the current time. The table i am trying to interact with has a field with the id,name,expiration date,entrance date,code of costumers, each customer has a different expiration date and this data is retrieved by using:
DateTime.Now.AddDays(numberofdaysstaying)
and the current time is retrieved by using:
DateTime.Now
My sql code is executed in a different class named sqlManager and the function i use to auto-delete is:
public void Autodelete()
{
using (SQLiteConnection sqlConn = new SQLiteConnection("Data Source=projecto.sqlite;Version=3;"))
{
sqlConn.Open();
//create command
SQLiteCommand sqlCommand = new SQLiteCommand("DELETE FROM cliente WHERE expirationDate < @td", sqlConn);
sqlCommand.Parameters.AddWithValue(Datetime.Now));
sqlCommand.ExecuteNonQuery();
}
And this does nothing really, there is no exception or anything like that... it just doesnt delete a thing. Any tips on how to make this work?