Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid SQLite Couldn't Found Declared Column
    primarykey
    data
    text
    <p>Okay, here's the situation: I've created a class extending Android's <code>SQLOpenHelper</code> class. I've also implemented the required methods, <code>onCreate</code> and <code>onUpgrade</code>, to initialize tables and to drop the current tables and then re-create new ones respectively.</p> <p>The tables were successfully created but when I tried to call a method to insert a new record to the database LogCat gave me this instead: </p> <pre><code>06-17 21:31:19.907: I/SqliteDatabaseCpp(561): sqlite returned: error code = 1, msg = table calendarEvents has no column named colour, db=/data/data/stub.binusitdirectorate.calendar/databases/calendarSQLite </code></pre> <p>I've done some search regarding this problem. Most of the answers suggested to re-install the app and repeat the process. Done, but still no success.</p> <p>Here's my SQLiteOpenHelper <code>onCreate</code> method:</p> <pre><code> public void onCreate(SQLiteDatabase db) { String CREATE_EVENTS_TABLE = "CREATE TABLE " + EVENTS_TABLE + "(" + KEY_EVENTS_TYPE_ID + " TEXT PRIMARY KEY," + KEY_EVENTS_TYPE_NAME + " TEXT," + KEY_EVENTS_NAME + " TEXT," + KEY_EVENTS_COLOR + "TEXT," + KEY_EVENTS_START_DATE + "DATE," + KEY_EVENTS_END_DATE + "TEXT" + ")" db.execSQL(CREATE_EVENTS_TABLE); } </code></pre> <p>And here's my method for inserting new records:</p> <pre><code> public void addEventsList(ArrayList&lt;CalendarEventData&gt; lstCalendarEvents) { SQLiteDatabase db = this.getWritableDatabase(); if (lstCalendarEvents != null &amp;&amp; db != null) { for (int i = 0; i &lt; lstCalendarEvents.size(); i++) { ContentValues values = new ContentValues(); values.put(KEY_EVENTS_TYPE_ID, lstCalendarEvents.get(i) .getEventTypeId()); values.put(KEY_EVENTS_TYPE_NAME, lstCalendarEvents.get(i) .getEventTypeName()); values.put(KEY_EVENTS_NAME, lstCalendarEvents.get(i) .getEventName()); values.put(KEY_EVENTS_COLOR, lstCalendarEvents.get(i) .getColour()); values.put(KEY_EVENTS_START_DATE, DateUtils .getFormattedDateString(lstCalendarEvents.get(i) .getStartDateTime(), dateFormat)); values.put(KEY_EVENTS_END_DATE, DateUtils .getFormattedDateString(lstCalendarEvents.get(i) .getEndDateTime(), dateFormat)); db.insert(EVENTS_TABLE, null, values); } db.close(); } } </code></pre> <p>I'm fairly new to Android and was using <a href="http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/" rel="nofollow">this tutorial</a> as a guide.</p> <p>Thanks in advance! :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload