我想知道查询以检查数据库中的特定记录是否已经存在于我的应用程序中。
我为这些做了一个功能,但它不能正常工作。
public boolean ifExisting(String name) {
Cursor c = db.rawQuery("SELECT * FROM " + TABLE_NAME + "WHERE" + "name" + "=" + name, null);
if(c.getCount() == 0)
return false;
else
return true;
}
这是我需要执行检查复制过程的功能的地方。
if(dh.ifExisting(dataVector.get(position)) == true) {
} else {
dh.insert(dataVector.get(position));
}
任何人都可以帮助我。
谢谢,大卫