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...
Similar Threads - Difficulty fetching password
  1. joe417
    Replies:
    4
    Views:
    348
  2. Raul McCai
    Replies:
    2
    Views:
    388
  3. h1r0ll3r
    Replies:
    7
    Views:
    559
  4. Milo Williamson
    Replies:
    3
    Views:
    642
  5. jhall68w
    Replies:
    6
    Views:
    1,190
  6. MoodyBlues
    Replies:
    6
    Views:
    729
  7. Dtronvig
    Replies:
    2
    Views:
    712
  8. Winfried
    Replies:
    4
    Views:
    1,359
  9. Atharv Thorat
    Replies:
    0
    Views:
    1,471
  10. Johncoool
    Replies:
    11
    Views:
    5,262

Share This Page

Loading...