Nikola Velimirovic
Nikola Velimirovic

Reputation: 33

Sqlite column doesn't exist

This is my problem; I'm creating tables from asset all are in one file and rest of the tables doesn't create any problem.

This one table is reporting:

04-29 22:13:09.434: E/SQLiteDatabase(6378): android.database.sqlite.SQLiteException: table gym_exercise has no column named date: , while compiling: INSERT INTO gym_exercise(cals,date) VALUES (?,?)

and this is the create statement

create table gym_training (_id integer primary key autoincrement, cals integer not null, date text not null);

I tried renaming this column, tried not inserting value for that column and then I'm getting constraint error .

Upvotes: 0

Views: 105

Answers (2)

Electro
Electro

Reputation: 3074

You've got the table names mixed up. You probably want to insert into gym_training, not gym_exercise.

Upvotes: 1

zmbq
zmbq

Reputation: 39013

Perhaps date has special meaning in SQLite, too (it does in other databases). Try changing the name to something else. You'll need to update all your references if this field is referenced from other tables (I think you can do that in SQlite, although the references aren't enforced)

Upvotes: 0

Related Questions