在SQL中我使用:
select * from Table_name where col_name like 'ex'
与sqllite android中的上述查询相同的是什么。 我在rawQuery(...)中尝试了这个,但它不起作用。
我试过了:
Cursor res = dB.rawQuery ("select * from Record where name like 'comp'"+"");
答案 0 :(得分:0)
查询将如下所示
try {
SQLiteDatabase db = this.getReadableDatabase();
String _Query = "SELECT * FROM " + _Table_Name;
Cursor cursor = db.rawQuery(_Query, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
// here you get the data on each row.
} while (cursor.moveToNext());
}
cursor.close();
db.close();
}
} catch (Exception e) {
Log.e("", "exception : " + e.toString());
}