vendredi 22 avril 2016

Retrieving Users Account

I have this app which gets users data from the database using the username they logged in with. The user name is passed once they login to the page which retrieves their account information. The app crashes saying retrieving the information was wrong, can anyone help?

The database code

public Cursor RetriveLoggedUsersData (DatabasOpperations DBOpp, String Username){
    SQLiteDatabase SQDB = DBOpp.getReadableDatabase();
    String[] Coloumns = {TableData.TableInfo.FIRSTNAME, TableData.TableInfo.LASTNAME, TableData.TableInfo.EMAIL, TableData.TableInfo.USERNAME, TableData.TableInfo.PASSWORD, TableData.TableInfo.IMAGE};
    String Where = TableData.TableInfo.USERNAME + " LIKE ?";
    String Argument[] = {Username};
    Cursor Cur = SQDB.query(TableData.TableInfo.TABLE_NAME, Coloumns, Where, Argument, null, null, null);
    Log.d("DatabaseOperations", "Success, User Retrived");
    return Cur;

The code which wants to retrieve the data

Username = getIntent().getExtras().getString("Username");

DatabasOpperations DB = new DatabasOpperations(Contx);
        Cursor Cur = DB.RetriveLoggedUsersData(DB, Username);
        DBFName = Cur.getString(0);
        DBLName = Cur.getString(1);
        DBEmail = Cur.getString(2);

Aucun commentaire:

Enregistrer un commentaire