I am asking the C# equivalent of this question. When I insert a row of data that has an auto-increment primary key, how can I then read the primary key back?
I need this for SQlite (this answers for SQL Server).
thanks - dave
I am asking the C# equivalent of this question. When I insert a row of data that has an auto-increment primary key, how can I then read the primary key back?
I need this for SQlite (this answers for SQL Server).
thanks - dave
// IDbCommand cmd
cmd.ExecuteScalar();
return ((SQLiteConnection) cmd.Connection).LastInsertRowId;
Very easy :)