jeudi 29 janvier 2015

SQLite delete query not working

I have a simple delete query which delete records based on Created date



int result = db.delete(TableName,"CreatedDate=?",new String[] { "STRFTIME('%d-%m-%Y', DATETIME('now'))" });


The above query is not working.


But when i am writing the same in this format



DELETE FROM TableName WHERE CreatedDate =STRFTIME('%d-%m-%Y',DATE('Now'))


Now its working.


i am not able to understand why one is working and another is not. What i am missing?


And my another question is behind the curtain what query is generated by this line



db.delete(TableName,"CreatedDate=?",new String[] { "STRFTIME('%d-%m-%Y', DATETIME('now'))" });


Please enlighten me!


Thanks


Aucun commentaire:

Enregistrer un commentaire