I have a problem using my database. Please check this:
// Database Name
private static final String DATABASE_NAME = "Poloha";
// Data table name
private static final String DATA = "Data";
// Data Table Columns names
private static final String KEY_Y= "Y";
private static final String KEY_X= "X";
private static final String KEY_ID = "_id";
private static final String KEY_NAZEV = "Nazev";
private static final String KEY_MAC = "MAC";
public void onCreate(SQLiteDatabase db)
{
String CREATE_CONTACTS_TABLE = "CREATE TABLE IF NOT EXISTS"
+ DATA + "("
+ KEY_ID + " INTEGER PRIMARY KEY autoincrement,"
+ KEY_NAZEV + " TEXT NOT NULL,"
+ KEY_MAC + " TEXT NOT NULL,"
+ KEY_X + " TEXT NOT NULL,"
+ KEY_Y + " TEXT NOT NULL);" ;
db.execSQL(CREATE_CONTACTS_TABLE);
}
Now I want to add some values using:
db.pridejZaznam(new Data(1,1,1,"NAZEV_1","MAC_1"));
db.pridejZaznam(new Data(2,2,2,"NAZEV_2","MAC_2"));
db.pridejZaznam(new Data(3,3,3,"NAZEV_3","MAC_3"));
db.pridejZaznam(new Data(4,4,4,"NAZEV_4","MAC_4"));
Problem is, LogCat is showing me this error:
02-22 10:33:26.336: E/SQLiteLog(813): (1) table Data has no column named Y
02-22 10:33:26.375: E/SQLiteDatabase(813): Error inserting Y=1 MAC=MAC_1 Nazev=NAZEV_1 _id=1 X=1
02-22 10:33:26.375: E/SQLiteDatabase(813): android.database.sqlite.SQLiteException: table Data has no column named Y (code 1): , while compiling: INSERT INTO Data(Y,MAC,Nazev,_id,X) VALUES (?,?,?,?,?)
Any idea what should I do? I´ve check similar errors and found only a solution with a missing SPACE while creating table but if I´m not blind, I have it without anything missing. Thanks all :)