Here is my table,
sqlStmt = [ [ NSString stringWithFormat:@"Create Table %@ (recordNo INTEGER PRIMARY KEY AUTOINCREMENT, noOfPlayer INTEGER, smallBlindAmt INTEGER, bigBlindAmt INTEGER , startingChips INTEGER, roundTimer INTEGER) " , SETTINGS_TABLE ] StringUsingEncoding:NSUTF8StringEncoding ] ;
insert query,
sqlStmt = [ [ NSString stringWithFormat: @"insert into %@ values (NULL,%d, %d ,%d ,%d ,%d )" , strTableName ,noOfPlayers, SmallAmt, BigAmt, StartingChips, RoundTime ] UTF8String ] ;
get last record's record id,
lastRecordNo = sqlite3_last_insert_rowid(dbObj);
The lastRecordNo is always 0, and I am unable insert another values because it gives the error primary key must be unique.
I am unable to get the problem associated with it?
How to fetch the last record id which is primary key and autoincrement.?
Is there any problem in my insert query?
Can anyone explain me with example create, insert and select queries where primary is an autoincrement?