Click here to Skip to main content
12,252,903 members (58,650 online)
Rate this:
Please Sign up or sign in to vote.
See more: Mobile 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);
     return value;
Posted 10-Nov-12 21:05pm
Edited 10-Nov-12 22:01pm
AndroidVivek 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 11 Nov 2012
Copyright © CodeProject, 1999-2016
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