Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..

Java
       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
Updated 10-Nov-12 22:01pm
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900