Issue
05-25 15:43:42.033: I/SqliteDatabaseCpp(383): sqlite returned: error code = 1, msg = no such column: mobile, db=/data/data/com.engrid.app.ts/databases/engrid_contacts_4.db
05-25 15:43:42.053: E/AndroidRuntime(383): FATAL EXCEPTION: main
05-25 15:43:42.053: E/AndroidRuntime(383): android.database.sqlite.SQLiteException: no such column: mobile: , while compiling: SELECT _id, data, username, address, location, email, mobile FROM main ORDER BY data COLLATE LOCALIZED ASC
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:146)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:367)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:130)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:46)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1539)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
05-25 15:43:42.053: E/AndroidRuntime(383): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
Solution
Closely verify the creating table syntax, you might be missing a comma or something very carelessly. Following is a correct example
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + ContactsTable.TABLE_NAME + " (" + ContactsTable._ID
+ " INTEGER PRIMARY KEY," + ContactsTable.COLUMN_NAME_DATA + " TEXT,"
+ ContactsTable.COLUMN_USER_NAME + " TEXT," + ContactsTable.COLUMN_ADDRESS
+ " TEXT," + ContactsTable.COLUMN_LOCATION + " TEXT," + ContactsTable.COLUMN_EMAIL
+ " TEXT," + ContactsTable.COLUMN_MOBILE + " TEXT" + ");");
}
try this!!Will work for sure..
ReplyDeletepublic void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + ContactsTable.TABLE_NAME + " (" + ContactsTable._ID
+ " INTEGER PRIMARY KEY ," + ContactsTable.COLUMN_NAME_DATA + " TEXT, "
+ ContactsTable.COLUMN_USER_NAME + " TEXT, " + ContactsTable.COLUMN_ADDRESS
+ " TEXT, " + ContactsTable.COLUMN_LOCATION + " TEXT, " + ContactsTable.COLUMN_EMAIL
+ " TEXT, " + ContactsTable.COLUMN_MOBILE + " TEXT )";
}
yeezy
ReplyDeletesupreme new york
curry 6
kd 11 shoes
hermes belt
yeezy shoes
jordan shoes
hermes
yeezy boost 500
russell westbrook shoes