如何在SQLite中的insert查询中返回自动增量值?

dub*_*tor 6 c# sqlite auto-increment

在我的项目中,我使用System.Data.SQLite.数据库有表Tags,其中包含自动增量主要字段ID(类型Integer).我写的时候:

using (SQLiteCommand command = conn.CreateCommand())
{
   command.CommandText = "insert into Tags(name) values(@name) returning into @id";
   command.Parameters.Add("@id", DbType.Int32).Direction = ParameterDirection.Output;
   command.ExecuteNonQuery();
}
Run Code Online (Sandbox Code Playgroud)

Visual Studio表示不支持该操作.怎么解决?

在线发生错误:

command.Parameters.Add("@id", DbType.Int32).Direction = ParameterDirection.Output;
Run Code Online (Sandbox Code Playgroud)

dub*_*tor 9

我找到了工作查询:

SELECT last_insert_rowid()
Run Code Online (Sandbox Code Playgroud)