光标,Sqlite。如何获取ID行?

时间:2013-09-30 06:43:31

标签: android

如何获取ID行? 我试着这是不可能的。

case R.id.buttonTest: {


            String[] projection = {DbTest.NAME};
            String selection = "_id = ?";
            String[] selectionArgs = { String.valueOf(1) };
             Cursor c = sqdb.query(DbTest.TABLE_NAME,projection,selection,selectionArgs ,null,null,null);
             if (c.moveToFirst()) {
                    String name = c.getString(c.getColumnIndex(DbTest.NAME));
                    textView1.setText(name);
                    }
            }

            break;

0 个答案:

没有答案