Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting Error Code = 1 in android, column not created
    primarykey
    data
    text
    <p>I am trying to insert a record in a database but I am getting error. What's the problem I am not getting. I tried the same code by removing IMAGEPATH column but still it gives same error for DESCRIPTION.</p> <p>DataBaseHelper: </p> <pre><code>public class GREDatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "gre_db.db"; private static final int DATABASE_VERSION = 1; public static final String TABLE_NAME_ENGLISH = "english_table"; public static final String COLUMN_NAME_WORD = "word_column"; public static final String COLUMN_NAME_SYNONYM = "synonym_column"; public static final String COLUMN_NAME_DESCRIPTION = "descrption_column"; public static final String COLUMN_NAME_IMAGEPATH = "image_column"; GREDatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String sqlQueryToCreateEnglishTable = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME_ENGLISH + " (" + COLUMN_NAME_WORD + "TEXT PRIMARY KEY, " + COLUMN_NAME_SYNONYM + "TEXT, " + COLUMN_NAME_DESCRIPTION + "TEXT, " + COLUMN_NAME_IMAGEPATH + "TEXT " + ");"; db.execSQL(sqlQueryToCreateEnglishTable); Log.d("Table_Created", "english_table"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } @Override public void onOpen(SQLiteDatabase db) { super.onOpen(db); } void addWord(EngFieldsClass obj) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put(COLUMN_NAME_WORD, obj.getengWord()); cv.put(COLUMN_NAME_SYNONYM, obj.getengSynonyms()); cv.put(COLUMN_NAME_DESCRIPTION, obj.getengDescription()); cv.put(COLUMN_NAME_IMAGEPATH, obj.getengImage()); // INSERT ROWS db.insertOrThrow(TABLE_NAME_ENGLISH, null, cv); db.close(); } </code></pre> <p>}</p> <p>InsertRecord Query:</p> <pre><code> String word=editTextWord.getText().toString(); String synonym= editText Synonym.getText().toString(); String description= editText Description.getText().toString(); String imgpath=textViewImagePath.getText().toString(); final GREDatabaseHelper db= new GREDatabaseHelper(this); db.addWord(new EngFieldsClass(word,synonym,description,imgpath)); </code></pre> <p>Error:</p> <pre><code>08-26 19:03:36.230: D/Table_Created(1350): english_table 08-26 19:03:36.239: I/Database(1350): sqlite returned: error code = 1, msg = table english_table has no column named image_column 08-26 19:03:36.249: D/AndroidRuntime(1350): Shutting down VM 08-26 19:03:36.259: W/dalvikvm(1350): threadid=1: thread exiting with uncaught exception (group=0x40015560) 08-26 19:03:36.269: E/AndroidRuntime(1350): FATAL EXCEPTION: main 08-26 19:03:36.269: E/AndroidRuntime(1350): android.database.sqlite.SQLiteException: table english_table has no column named image_column: , while compiling: INSERT INTO english_table(image_column, descrption_column, synonym_column, word_column) VALUES(?, ?, ?, ?); </code></pre>
    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.
    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