I have a db that is created like this...
public class DataBaseManager extends SQLiteOpenHelper{
Context mContext;
private static final String TAG =
Change your old query "SELECT "+colID+ " FROM " + allScreens + " WHERE " + colName + "=" +name;
to
"SELECT "+colID+ " FROM " + allScreens + " WHERE " + colName + "='" +name+"'";
Your query String is wrong
String selectQuery = "SELECT "+colID+ " FROM " + allScreens + " WHERE " + colName + " = '" +name + "'";
the name you give in where should be in single quotes
Do it like this:
String selectQuery = String.format("SELECT %s FROM %s WHERE %s = ?",
colID, allScreens, colName);
Cursor c = db.rawQuery(selectQuery, new String[]{name});
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"
name = DR_home
means "column name equals column DR_home
. You probably want to quote it if you want to string search (which I surmise you do, but I haven't peeked your code in depth since it's too long): name = 'DR_Home'
.