本文介绍了rawQuery(查询,selectionArgs两个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用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 "?"

这篇关于rawQuery(查询,selectionArgs两个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 11:10