sqlite - Can't retrieve auto generated primary key using Vici Coolstorage -


i'm using vici coolstorage in windows forms project access sqlite database. in every table in database there field called id defined integer primary key, auto increment field.

i'm trying retrieve value of field after store object in database, value 0 instead of real id. vici coolstorage documentation states "if primary key defined autonumber (identity) field in database, can retrieve generated primary key after object saved", doesn't seem true unless i'm doing wrong. please me. code reproduce problem:

<mapto("company")> public mustinherit class company     inherits csobject(of company, integer)     public mustoverride readonly property id integer     public mustoverride property name string end class  sub somemethod()     dim c company = company.[new]     c.name = "some name"     c.save()     messagebox.show(c.id)  'this prints 0!!! end sub 

thank you!

had faced issue , figured out setting identity attribute on field solved this.

[identity] public int id {     { return (int)getfield("id"); } } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -