如何在SQLite查询的Text字段中添加WHERE条件?

时间:2015-09-09 12:13:28

标签: sqlite android-sqlite

我想通过在文本字段上过滤来选择一些数据,但是存在问题 如果我将WHERE条件更改为Integer类型,则问题就会消失 使用文本字段添加WHERE子句是否有问题?

 Cursor cursor= sqLiteDatabase.query(tableName,columns,"Id=9" ,null,null,null,null);   this query is working very well But;
 Cursor cursor= sqLiteDatabase.query(tableName,columns,"whichWeek=Week 5" ,null,null,null,null);   this is not working. I don't understand :(


        db.execSQL(
                "create table "+tableName+" ( "
                        +Id+" integer primary key autoincrement,"+
                        evName+ " text not null,"+
                        depName+ " text not null,"+
                        evGol+ " integer,"+
                        depGol+" integer,"+
                        whichWeek+ " text not null );"
        );

0 个答案:

没有答案