Skip to content Skip to sidebar Skip to footer

Android Sqlite Exception:java.lang.illegalargumentexception: Column '_id' Does Not Exist

I created a sql lite database with the following columns: static final String dbName='demoDB'; static final String tableName='Employees'; static final String colID='Employe

Solution 1:

a workaround to this problem is to use select statment like this

select EmpId as _id

cause the adapter requires a column with the name _id as you said

thanks

Solution 2:

When using an adapter, your Table must always have the Primary Key Column named as "_id"

Just change

staticfinalString colID="EmployeeID"; 

to

staticfinalString colID="_id"; 

Cheers!

Solution 3:

CursorAdapters require an INTEGER PRIMARY KEY column named _id (available from BaseColumns).

Solution 4:

Try this way

SELECT  _ID as _ID,_ID as _id , cont_type ,.... FROM  DATABASE_TABLE ;

When _ID only ,Message iscolumn'_id' does not exist.
When _id only ,Message iscolumn'_ID' does not exist.

Solution 5:

I tried _id (lower case) instead of _ID (Uppercase) solves the problem. Make sure to recreate the DB once again with _id (lowercase)

Thank you very much

Post a Comment for "Android Sqlite Exception:java.lang.illegalargumentexception: Column '_id' Does Not Exist"