0

我正在开发一个 android 应用程序,我想根据 where 子句和 like 子句删除一行。下面是我尝试过的代码,

            String where = "numberp Like '%''"+phonetounbold+"'";
            String[] whereArgs = null;

            delcount = db.delete("NUMBERLIST", where, whereArgs);

在上表中,我想从 NUMBERLIST 表中删除一行,其中包含来自 numberp 列的类似 phonetounbold 的字符串。但是上面的查询不起作用。我的语法哪里出错了。请帮忙。谢谢!

4

3 回答 3

1

尝试将“where”子句更改为

String where = "numberp LIKE '%"+phonetounbold+"'";

于 2013-10-05T06:16:54.050 回答
0

如果您使用原始 SQLiteDatabase 接口而不是内容提供程序进行开发,则可以直接使用execSQL方法:

database.execSQL("delete from numberlist where numberp like '%xyz%'")
于 2013-10-05T06:14:48.080 回答
0

试试这个

String where = "numberp Like '%" + phonetounbold + "'";
于 2013-10-05T06:17:17.897 回答