vendredi 1 avril 2016

Error while inserting data into a database

I am getting error while inserting data in to sqlite data base.This is my query. What is the problem.

I am not able get out of this. I think error because of space in creating table, where i need to make changes.

@Override
    public void onCreate(SQLiteDatabase db) {
        String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
                + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
                + KEY_PH_NO + " TEXT," + KEY_MACID + " TEXT" + ")";
        db.execSQL(CREATE_CONTACTS_TABLE);
    }

This is the error i am getting.

Error inserting macid=benbena phone_number=01-04-2016 17:32:31 PM name=testlock1@acttv.in android.database.sqlite.SQLiteException: table contacts has no column named macid (code 1): , while compiling: INSERT INTO contacts(macid,phone_number,name) VALUES (?,?,?)

Aucun commentaire:

Enregistrer un commentaire