如何在Android应用程序中执行一个SQLite查询?应用程序、如何在、Android、SQLite

由网友(弄不死你i)分享简介:我想在我的Andr​​oid数据库来使用此查询,但是它不返回任何数据。我失去了一些东西?SQLiteDatabase DB = mDbHelper.getReadableDatabase();串选择=选择_id,标题,title_raw从搜索凡(title_raw如+%史密斯%'+);光标光标= db.query(TA...

我想在我的Andr​​oid数据库来使用此查询,但是它不返回任何数据。我失去了一些东西?

  SQLiteDatabase DB = mDbHelper.getReadableDatabase();
    串选择=选择_id,标题,title_raw从搜索凡(title_raw如+%史密斯%'+
    );
    光标光标= db.query(TABLE_NAME,距离,
            选择,NULL,NULL,NULL,NULL);
    startManagingCursor(光标);
    返回游标;
 

解决方案

这将返回你所需要的光标

 光标光标= db.query(TABLE_NAME,新的String [] {_id,标题,title_raw},
                title_raw像+%史密斯%',NULL,NULL,NULL,NULL);
 
Android应用程序可以运行在Windows手机当中了

I am trying to use this query upon my Android database, but it does not return any data. Am I missing something?

SQLiteDatabase db = mDbHelper.getReadableDatabase();
    String select = "Select _id, title, title_raw from search Where(title_raw like " + "'%Smith%'" +
    ")";        
    Cursor cursor = db.query(TABLE_NAME, FROM, 
            select, null, null, null, null);
    startManagingCursor(cursor);
    return cursor;

解决方案

This will return you the required cursor

Cursor cursor = db.query(TABLE_NAME, new String[] {"_id", "title", "title_raw"}, 
                "title_raw like " + "'%Smith%'", null, null, null, null);

阅读全文

相关推荐

最新文章