简体   繁体   中英

Android Studio (SQLite Database), I am gonna to add a LineNo to a table and how can I make it will auto increment by 1?

I am gonna to add a LineNo to a table and how can I make it will auto increment by 1? LineNo is no the primary key so how I make it will will auto increment by 1?

This is what I tried, but no working: String query_edit = "UPDATE " + TABLE_NAME_INV_DTL + " SET " + COL15_INV_DTL + "= +1 "; db.execSQL(query_edit);

Try this

String query_edit = "UPDATE " + TABLE_NAME_INV_DTL + " SET " + COL15_INV_DTL + "=" + COL15_INV_DTL + " +1 "; 
db.execSQL(query_edit);

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