sqlite query failing - no such column

后端 未结 5 1906
梦谈多话
梦谈多话 2021-01-15 04:53

I have a db that is created like this...

public class DataBaseManager extends SQLiteOpenHelper{

    Context mContext;
    private static final String TAG =          


        
5条回答
  •  攒了一身酷
    2021-01-15 05:03

    Your query is wrong, as WHERE column = string will not work.

    String selectQuery = "SELECT "+colID+ " FROM " + allScreens + " WHERE " + colName + "=?";
    Cursor c = db.rawQuery(selectQuery, new String[] {name});
    

    Use ? which will be replaced by the second rawQuery() parameter. Strongly recommended.

    Not recommended: WHERE column = "string"

提交回复
热议问题