The correct syntax is DELETE FROM tableName [WHERE expr]
(The underlying implementations all use SQLite, AFAIK.)
However, there are several related problems:
The condition used is wrong, SQL uses
=
for equality.rowid
, as string content, is wrong. That will never be the ID because no "magic replacement" is done. Instead, use a parameterized query and specify the bound value.
Consider:
function deleteRecord(rowid) {
var db = getCurrentDatabase();
db.transaction(
function (tx) {
tx.executeSql("DELETE FROM demo WHERE id = ?", [rowid]);
});
}
I also used a closure to make rowid
readily accessible. Refer to some tutorials for more general and examples.