This tutorial describes how to delete rows from a database table.
The deletion of a record from a database can be performed by executing the DELETE SQL statement. The query does not pass or return any data.
Configure the SQL statement
Create a literal for your DELETE statement. You do not need to create a RSqlStatement object to run a DELETE statement. You need to just execute the query with the RSqlDatabase object, which has its own RSqlDatabase::Exec() function taking a query string as its parameter.
_LIT(kQueryString,"DELETE FROM countries WHERE population < 2;");
NOTE : It is possible to call a DELETE statement from an RSqlStatement object, but it is computationally more expensive and you are recommended not to do so.
Execute the statement
Execute the DELETE statement. This code assumes that the countriesDatabase object is open.
countriesDatabase.Exec(kQueryString);
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.