c# - How to return autoincrement value in insert query in SQLite? -


in project use system.data.sqlite. database has table tags, contains autoincrement primary field id (type integer). when write:

using (sqlitecommand command = conn.createcommand()) {    command.commandtext = "insert tags(name) values(@name) returning @id";    command.parameters.add("@id", dbtype.int32).direction = parameterdirection.output;    command.executenonquery(); } 

visual studio said operation not supported. how fix it?

error occurs on line:

command.parameters.add("@id", dbtype.int32).direction = parameterdirection.output; 

i found working query:

select last_insert_rowid() 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -