开发者

Why SQLite Primary Key column auto incrementing is not working? [closed]

It's difficult to tell what is being aske开发者_开发技巧d here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I am using SQLite3 in my Android app and I was having a hard time trying to query records I had already insert.

After much debugging, I found out that the problem was that the SQLite auto increment was NOT working.

The problem is that SQLite3 treats

"CREATE TABLE test_table (
id **INT** PRIMARY KEY,
name text)";

differently from

"CREATE TABLE test_table (
id **INTEGER** PRIMARY KEY,
name text)";

Using INTEGER PRIMARY KEY works fine to create an auto increment column, whereas using INT PRIMARY KEY will simple NOT work.

Thanks this author where I found this info. http://mydumbthoughts.wordpress.com/2010/06/12/sqlite-primary-key-column-not-auto-incrementing/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜