SQLite INSERT - How to get the New ID
Posted: Sat Jan 26, 2013 2:27 pm
Hi,
I've gotten to the stage where I am now want to INSERT a record into my SQLite database
When I created the table in my DB (CREATE TABLE...), I set the first field/column of that Table to be :
integer PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE
like this
CREATE TABLE DBProperties (PID integer PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, ........
This works just fine. And I progressed to the point where...
I can now UPDATE a record BUT cannot for the life of me see how to get my new DB_ID value back out so of my newly created / INSERTed record...
Is there a way for me to get the DB_ID, that SQLite just created/inserted, rather than having to send my user back to a full list of DB records and expect them to fin and then select the record they've just entered ? ? ?
I note that the revExecuteSQL command simply returns the number of affected rows/records, a 0 or an ERR.... value
What I had hoped for was the newly created Record ID... I simply can't see how to get at this for a newly created record... Arrrgh...
TIA
Regards.
I've gotten to the stage where I am now want to INSERT a record into my SQLite database
When I created the table in my DB (CREATE TABLE...), I set the first field/column of that Table to be :
integer PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE
like this
CREATE TABLE DBProperties (PID integer PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, ........
This works just fine. And I progressed to the point where...
I can now UPDATE a record BUT cannot for the life of me see how to get my new DB_ID value back out so of my newly created / INSERTed record...
Is there a way for me to get the DB_ID, that SQLite just created/inserted, rather than having to send my user back to a full list of DB records and expect them to fin and then select the record they've just entered ? ? ?
I note that the revExecuteSQL command simply returns the number of affected rows/records, a 0 or an ERR.... value
What I had hoped for was the newly created Record ID... I simply can't see how to get at this for a newly created record... Arrrgh...
TIA
Regards.