简体   繁体   中英

Why is my SQL create statement causing my app to crash?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM