Android SQLite rawQuery() method
I created a table with 3 columns id,name & discipline.. I want to find the
student name given the discipline...
Following is my method....
String findstudent(String disc){
SQLiteDatabase sqLiteDatabase = this.getReadableDatabase();
String find = "SELECT * FROM "+ TABLE_STUDENTS + " WHERE
"+KEY_DISCIPLINE +" = " +disc ;
Cursor cursor = sqLiteDatabase.rawQuery(find,null);
cursor.moveToFirst();
String found =cursor.getString(1);
return found;
}
When i use it, the application stops working... Pls help me...
Thanks
No comments:
Post a Comment