i want compare user name , password database if exists success if not throws error use sqliteopenhelper don task can 1 field database how can retrieve multiple fields
public userinfo get_user_by_id(string id) { sqlitedatabase db = this.getreadabledatabase(); userinfo userinfo = null; cursor cursor = db.query(table_name, new string[]{column_app_id}, column_app_id + "=?", new string[]{id + ""}, null, null, null); while (cursor.movetonext()) { //userinfo.setappid(cursor.getstring(cursor.getcolumnindex(column_app_id))); userinfo = new userinfo(cursor.getstring(cursor.getcolumnindex(column_app_id))); } please me in advance
return list of userinfo method get_user_by_id().
public arraylist<userinfo> get_user_by_id(string id) { arraylist<userinfo> listuserinfo = new arraylist<userinfo>(); sqlitedatabase db = this.getreadabledatabase(); cursor cursor = db.query(table_name, new string[]{column_app_id}, column_app_id + "=?", new string[]{id + ""}, null, null, null); if (cursor != null) { while (cursor.movetonext()) { userinfo userinfo = new userinfo(); userinfo.setappid(cursor.getstring(cursor.getcolumnindex(column_app_id))); // here can multiple record , add list listuserinfo.add(userinfo); } } return listuserinfo; }
Comments
Post a Comment