0

I have a c# project that uses sqlite and I wonder if there is something like the mysql_insert_id method as in php ?

Thanks

eemceebee
  • 2,656
  • 9
  • 39
  • 49

2 Answers2

3

For SQLite3 SELECT last_insert_rowid() should work, as explained here: how to get last inserted Id of a Sqlite database using Zend_Db

Community
  • 1
  • 1
bogdan
  • 671
  • 5
  • 16
1

The SQLite base API (in C) has sqlite3_last_insert_rowid which looks ideal for this sort of thing. It's also available at the SQL level via the last_insert_rowid() function. I don't know how this maps to C#, but that should help you when looking.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215