Click here to Skip to main content
12,816,775 members (34,082 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);
        Log.v("message","vlaue:"+value+"");
        cursor.close(); 
        
        return value;
    }
Posted 10-Nov-12 22:05pm
Updated 10-Nov-12 23:01pm
ridoy59.1K
v2
Comments
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
Web02 | 2.8.170308.1 | Last Updated 11 Nov 2012
Copyright © CodeProject, 1999-2017
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