SQLite query SQLiteLog (1) no such Column:
Surrounding the NAME in fetchSiteIdByName() with single quotes might help.
dbCursor = database.query(true, TABLE5, new String []{S_ID}, S_NAME + "= '" + NAME + "'" , null, null, null, null, null);
I'm not much sure if it will work on SQLite but I've been through same kind of issues in MySQL and it helps. Moreover, when you fetch non-numeric values in the database you surround them in single quotes.
Hope it helps. :)
It appears I had 3 different issues but using Lokesh's links and post's help me get a fix.
I modified the SQL string in DBelper.java to this
String sql5 = String.format("create table %s (%s INTEGER PRIMARY KEY **AUTOINCREMENT**, %s TEXT, %s TEXT, %s TEXT, %s TEXT, %s INT, %s TEXT)", TABLE5, S_ID, S_CLIENT, S_NAME, S_POSTCODE, S_CON_NAME, S_CON_NUM, S_LAST_TEST);
And added to the DBControl.java class
**if**(dbCursor.moveToFirst()) id = dbCursor.getLong(dbCursor.getColumnIndex(S_ID));
Dropping the semicolon after the moveToFirst()). Like I said I'm a real noob but believe this to be correct.
Adding the AUTOINCREMENT had 1 dramatic effect when I uninstalled and reinstalled the application (I could have changed the DB version instead, if I wanted too, I know).
When the Tables were rebuilt they did not have the column _id I had seen before. So I think the SQL string was the reason for my failure. I'm sure I heard somewhere it wasn't required for PRIMARY KEY basecolumns._ID but now I know IT IS.
Thanks Lokesh for your pointers. I couldn't have found the issue without some guidance and I really appreciate it.
I tried to add to the up arrow but don't have enough rating yet. Doh.
Hope this helps others.