我收到此错误
android.database.sqlite.SQLiteException: near "SELECT": syntax error: , while compiling: SELECT _id, c_type, s_name, s_numb, user_name, password FROM accounts WHERE SELECT * FROM TableName LIMIT 1 OFFSET 1
这是产生问题的代码。我的意图是ith
从表中获取记录的 ROWID,然后使用该 ROWID 从表中删除一个条目。
public void deleteEntry(long i) {
String[] columns = new String[]{KEY_ROWID, KEY_CTYPE, KEY_SNAME, KEY_SNUMB, KEY_USRN, KEY_PASS};
Cursor cursor = ourDatabase.query(DATABASE_TABLE,columns,"SELECT * FROM " +DATABASE_TABLE+" LIMIT 1 OFFSET "+i, null, null, null, null, null);
if (cursor != null && cursor.moveToFirst())
{
cursor.moveToFirst();
long rowIds = cursor.getLong(0);
ourDatabase.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowIds, null);
}
// ourDatabase.delete(DATABASE_TABLE, KEY_SNUMB + "=" + siteNum, null);
//return ourDatabase.insert(DATABASE_TABLE,null,cv);
}