我有这段代码不起作用。谁能告诉我我做错了什么?
String option = names.getText().toString();
Cursor c = db.rawQuery("SELECT * from numbers Where fname=option", null);
答案 0 :(得分:1)
更改如下:
Cursor c = db.rawQuery("SELECT * from numbers Where fname='"+option+"' ", null);
答案 1 :(得分:1)
试试这个
String query = "SELECT * from numbers Where fname='"+ option +"'";
database.execSQL(query);
答案 2 :(得分:1)
首选使用?
占位符的预备声明。
String option = names.getText().toString();
String query = "SELECT * from numbers Where fname = ?"
Cursor c = db.rawQuery(query, new String[] {option});