xamarin - SQLite.Net Update generating error "it has no PK" -
i'm using lync syntax in pcl using xamarin.
public class settings { [primarykey, autoincrement] public int id { get; set; } public string user_name { get; set; } public string password { get; set; } public string server { get; set; } } void createtables() { database.createtable<settings>(); } void insert() { settings s = new settings(); s.server = "<none>" s.user_name = ""; s.password = ""; database.insert(s) } void update() { settings s = database.table<settings>().firstordefault(); s.server = server_address.text; s.user_name = user_name.text; s.password = pass.text; database.update(s) }
i cannot update settings: has no pk when updating inserting works fine. i'm using xamarin in pcl referencing sqlite.net. i'm new sqlite , xamarin please verbose when asking more detail.
update - resolved
the class in same namespace place create instance of database object. adding "sqlite" attribute fixed issue strange.
[sqlite.primarykey, sqlite.autoincrement]
Comments
Post a Comment