Note that there are some explanatory texts on larger screens.

plurals
  1. PO(1) table Table_name has no column named Column_name
    primarykey
    data
    text
    <p>I insert the record by using following code.But I get the error mentioned above as in title.For some time it will work fine but often it will shows the error like this.My code is,</p> <pre><code> String CREATE_MESSAGES_TABLE = "CREATE TABLE " + TABLE_MESSAGES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_FROM + " TEXT," + KEY_TO + " TEXT," + KEY_BODY + " TEXT," + KEY_DATE + " TEXT," + KEY_STATUS + " TEXT" + ")"; db.execSQL(CREATE_MESSAGES_TABLE); </code></pre> <p>Here I have called the method as,</p> <pre><code> dbHandler.Add_Message(new Message(fromno,tonum,bodyy,datt,stt)); </code></pre> <p>And this is my Add_Message method,</p> <pre><code>public void Add_Message(Message contact) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_FROM, contact.getmsgfrom()); // Contact Name values.put(KEY_TO, contact.getto()); // Contact Phone values.put(KEY_BODY, contact.getmsg()); values.put(KEY_DATE, contact.getdate()); values.put(KEY_STATUS, contact.getstatus());// Contact Email db.insert(TABLE_MESSAGES, null, values); db.close(); } </code></pre> <p>And this is the code for getting particular column,</p> <pre><code> public int calculateunread(){ SQLiteDatabase db = this.getReadableDatabase(); String unreadquery="SELECT COUNT(*) FROM " + TABLE_MESSAGES + " WHERE " + KEY_STATUS + "='0'"; Cursor cursor = db.rawQuery(unreadquery, null); int a=cursor.getCount(); cursor.close(); return a; } </code></pre> <p>But I can't insert my records, what mistake I made here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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