在android中执行sqlite中的select查询时出错

时间:2015-03-01 03:33:57

标签: android sql sqlite

我已经通过android为sqlite db中的select过滤数据编写了这段代码。但它说有一些错误。你能帮我改正一下我的代码吗?

    category = data[0];
    district = data[1];

    SQLiteDatabase db = openOrCreateDatabase("dbumbers", 1, null);      

    Cursor c = db.rawQuery("SELECT * FROM numbers where [category = '"+category+"'] and [district = '"+district+"']", null);

1 个答案:

答案 0 :(得分:0)

你应该用这个:

Cursor c = db.rawQuery("SELECT * FROM numbers where category = '"+category+"' and district = '"+district+"'", null);

您必须从查询中删除[]