我想用select查询从表中检索数据。我已发现,SQLiteDatabase类rawQuery(查询,selectionArgs两个)方法检索数据。但我不知道如何查询和selectionArgs两个应该传递给rawQuery方法?任何人可以帮助我。
在此先感谢。
解决方案 rawQuery(SELECT ID,名称从不同人的名字=?和id =?,新的String [] { 大卫,2});
您传递一个字符串数组相同数量的元素,你有?
I want to use select query for retrieving data from table. I have found, rawQuery(query, selectionArgs) method of SQLiteDatabase class to retrieve data. But I don't know how the "query" and "selectionArgs" should be passed to rawQuery method? Can anybody help me.
Thanks in advance.
解决方案rawQuery("SELECT id, name FROM people WHERE name = ? AND id = ?", new String[] {"David", "2"});
You pass a string array with an equal number of elements as you have "?"