I have two functions.
One Insert into database. It opens the connection and closes it after insert. Other is GetLastID function.
I know I could query the biggest ID but I was told it's a bad practice.
"SELECT sqlite_last_insert_rowid();" seems no use since I'm closing the connection after Insert.
SELECT seq FROM sqlite_sequence where name=@Table
It has solved the issue.