1. Are you ready for the Galaxy S20? Here is everything we know so far!

Difficulty in fetching password from a specific row

Discussion in 'Android Development' started by AQSAANUM, Jul 23, 2017.

  1. AQSAANUM

    AQSAANUM Member
    Thread Starter

    Hey friends,

    I have written the code for fetching id and password from sqlite database. When I remove password fetching statement it works fine but if I write password fetching statement and run the app, that doesn't works for me.
    Without password fetching this works fine, but I have to fetch password for confirming that an id is existing in SQLite database, here is the code,
    please see and suggest.

    Code (Java):
    1.  SQLiteDatabase db = dbHelper.getReadableDatabase();
    2.         Student student = new Student();
    3.         Cursor cursor = db.query(Student.TABLE, new String[] {Student.KEY_ID, Student.KEY_password}
    4.                 , Student.KEY_ID +  "=?",
    5.                 new String[] { id }, null, null, null, null);
    6.  
    7.         if (cursor.getCount() == 0){
    8.             loginTest = false;
    9.             }
    10.         if (cursor.moveToFirst()){
    11.             cursor.getString(cursor.getColumnIndex(Student.KEY_password));
    12.           return true;
    13.  
    14.             }
    15.         return loginTest;
     


  2. Best Answer:
    Post #2 by Deleted User, Jul 23, 2017 (1 points)

    1. Download the Forums for Android™ app!


      Download

       
  3. Deleted User

    Deleted User Guest

    What "doesn't work"? Usual request, you know the script: Does the application crash? If so please provide stack trace.
     
  4. AQSAANUM

    AQSAANUM Member
    Thread Starter

    Sorry :) I have not posted the stack trace,
    but as usual I have solved the problem :)
    Thanks for comment on my programming post as usual :)
     
Loading...

Share This Page

Loading...