Last inserted RowID
Posted: Mon 01 Oct 2012 22:43
I've got a TLiteQuery object which I'm using to insert a row into my database. The SQL property contains the INSERT statement which is postfixed by "; SELECT LAST_INSERT_ROWID() AS rowid". After binding my params and macros I execute it like this:
The issue I'm experiencing is that I get an error from the operation that the query does not return any rows. The INSERT statement is executed successfully however. I'm using the direct mode.
Code: Select all
Query.Open;
if Query.FindFirst then
Result := Query.FieldByName('rowid').AsLargeInt;
Query.Close;