0

Androidプログラムでこのクエリを書きたい

sourec='lee' および destination='jhon' の temp2 からルートを選択します。

私はこのようなことを試しました

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 に答える