嗨这是我的第二个问题。我有下表
|-----|-------|------|------|
|._id.|..INFO.|.DONE.|.LAST.|
|..1..|...A...|...N..|......|
|..2..|...B...|...Y..|..L...|<--- cursor.moveToPosition((int)_id-1);
|..3..|...C...|...Y..|......|
|..4..|...D...|...Y..|......|
|..5..|...E...|...N..|......|
|..6..|...F...|...N..|......|
|-----|-------|------|------|
我使用代码:
cursor = db.query(TABLE_NAME, new String[]{INFO,DONE,LAST},null,null,null,null,null);
cursor.moveToPosition((int)_id-1);
String Yval = cursor.getString(cursor.getColumnIndex(DONE));
do
{
cursor.moveToNext();
Yval= cursor.getString(cursor.getColumnIndex(DONE));
}
while (Yval=="Y");
s = Yval;
我最初将光标指向我访问的最后一行,然后我循环遍历 DONE 列中的值,如果该列的行中有 Y,则不会停止。当循环中出现 N 时,循环应该停止。但它不起作用。Yval 从不等于“Y”。因此光标执行了一次“moveToNext”然后退出循环,因为它不会将 Yval 读取为“Y”。(我还将所有内容都更改为整数。1 表示 N,0 表示 Y,但它仍然不起作用)那么我在这里做错了什么?