我将字符串传递给下面的代码,它给出了错误:
Error: 08-24 12:57:55.583: E/AndroidRuntime(11640): android.database.sqlite.SQLiteException: near "RAMDEV": syntax error: , while compiling: SELECT chnno FROM EPG WHERE title = BABA RAMDEV KA YOGA
我的代码在这里:
public String SearchChnNo(String title){
String selectQuery = "SELECT " + chn_no + " FROM " + EPG + " WHERE " + pgm_title + " = " + title ; //error
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
String chnno = cursor.getString(1);
return chnno;
}