1

Error message:

android.database.sqlite.SQLiteException: near "transaction": syntax error (code 1): , while compiling: **create table transaction ( _id integer primary key autoincrement, amount real, type varchar(20), date integer)

My app stores monetary transactions composed of an auto-generated ID, the amount spent, and type of payment and the date. My app compiles fine, but when i try run the activity in which the database is sqlite database is created, the app crashes with the above message. As far as im aware my SQL statement is valid, could anybody offer any insight into what could possibly be the cause?

Java Code:

 db.execSQL("create table transaction (" +
        " _id integer primary key autoincrement, amount real, type varchar(20), date integer)");

Thanks

Adam S
  • 16,144
  • 6
  • 54
  • 81
Dom Shahbazi
  • 720
  • 2
  • 10
  • 25

1 Answers1

10

transaction is an SQLite Keyword. Name your table something else (say, sales).

Adam S
  • 16,144
  • 6
  • 54
  • 81