Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
hello i have this code i want to retrive a vaule from field in table and store it into string to print it but it gives me exception can anyone help me plz?
i want to retrive the value in field related_Question..
 
          String sqlqueries="select related_Question from relatedQuestion where word= 'بدي'";
                         
                           
           String r=db.fitshData(sqlqueries);
 
   public String fitshData(String sql){
        SQLiteDatabase db = this.getReadableDatabase(); 
      //  db.execSQL(sql);
        Cursor cursor = db.rawQuery(sql, null); 
        int col1 =cursor.getColumnIndex("related_Question");
        String value = cursor.getString(col1);
        Log.v("message","vlaue:"+value+"");
        cursor.close(); 
        
        return value;
    }
Posted 10-Nov-12 22:05pm
Edited 10-Nov-12 23:01pm
(no name)53.3K
v2
Comments
AndroidVivek at 22-Nov-12 0:22am
   
remove space at last word='abc'
String sqlqueries="select related_Question from relatedQuestion where word='بدي'";

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 240
1 CHill60 210
2 Peter Leow 170
3 Richard Deeming 166
4 Richard MacCutchan 159
0 Sergey Alexandrovich Kryukov 9,248
1 OriginalGriff 6,806
2 Peter Leow 4,432
3 Zoltán Zörgő 3,919
4 Richard MacCutchan 2,782


Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 11 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100