开发者

sqlite query related issue

I have certain sqlite data having the certain code.

String sql = "create table " + TABEL
    +"( " + BaseColumns._ID+" integer PRIMARY KEY AUTOINCREMENT," + STARTTIME
    + " text," + ENDTIME + " text," + DURATION + " text,"
    + PHONEOPTION + " text," + MODE + " text);";

    db开发者_如何学C.execSQL(sql);
    Log.i("DATABASE ", "db created ");

and i want to fetch the rows where duration column having not null data. i have certain code but it fetch the all data in it.

public Cursor getData() {
    SQLiteDatabase sqlitedb = contactsdbHelper.getReadableDatabase();
    Cursor cursor = sqlitedb.query(ContactsDatabaseHelper.TABEL, null,null,null, null,null, BaseColumns._ID + " DESC");

    startManagingCursor(cursor);
    return cursor;

}


Try something like:

Cursor cursor = sqlitedb.rawQuery(
    "SELECT * FROM " + ContactsDatabaseHelper.TABEL + " WHERE " +
    ContactsDatabaseHelper.DURATION + " NOT NULL", null);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜