Android sqlite query

2022/1/26 19:04:26

本文主要是介绍Android sqlite query,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

SQLiteDatabase db = dbhelper.getWritableDatabase();
        
        String table =  Player.TABLE_NAME ;
        String[] columns = new  String[] { Player.KEY_USER_PASS };
        String selection = Player.KEY_USER_NAME+"=?" ;
        String[] selectionArgs = new  String[]{username};
        String groupBy = "" ;
        String having = "" ;
        String orderBy = "" ;
        
        Player player = new Player();
        Cursor cursor = db.query(table,columns,selection,selectionArgs,groupBy,having,orderBy);
        player.setPlayer_id(cursor.getInt(cursor.getColumnIndex(Player.KEY_ID)));
        player.setUser_name(cursor.getString(cursor.getColumnIndex(Player.KEY_USER_NAME)));
        player.setUser_pass(cursor.getString(cursor.getColumnIndex(Player.KEY_USER_PASS)));
        return player;


这篇关于Android sqlite query的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程