0

我想在我的 android 程序中写这个查询

从 temp2 中选择 root,其中 sourec='lee' 和 destination='jhon'

我尝试过这样的事情

Cursor c=db.rawQuery("select root from Temp2 where  sourec='" + so + "' and destination='" + de + "'",null);

                   c.moveToFirst();
                   while(!c.isAfterLast())
                   {
                   Toast.makeText(HandelDatbase.this,c.getString(0),1000).show();
                   c.moveToNext();
                   }
                   c.close();
               }

但是没有得到答案请帮助我...

4

1 回答 1

0

只需使用它(它首选原始查询):

Cursor cursor = db.query("Temp2", new String[]{root}, "source= ? and destination = ?", new String[] {so, de}, null, null, null);
cursor.moveToFirst();
 while (!cursor.isAfterLast()) {
     Toast.makeText(HandelDatbase.this, cursor.getString(0), 1000).show();
     cursor.moveToNext();
 }
 cursor.close();

也许,它source和不是sourec

于 2013-05-22T09:42:03.997 回答