Hi,
I am using SQLite.Net to store my records for RadListview in Xamarin PCL. I have to update records once users click on list item to modify it's status as already viewed item. Eventhough I have auto increment and primary key attributes on selected columns, autoincrement doesnot sem to work and it always stores '0' for it's value. I have three records in SQLite.Net ORM table each with unique ID, when I try to Update record, it throws 'it has no PK " error.
I looked into Xamarin forum too but couldnot find any answers, has anyone encountered this error or knows how to fix it?
Here is my model:
public class NotificationSettings
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public string NotificationName{ get; set; }
public string NotificationValue{ get; set; }
public bool IsCleanData { get; set; }
}
Public class NotificationModifier{
public void Update() {
NotificationSettings s = database.Table<NotificationSettings>().FirstOrDefault();
s.IsCleanData = false; //This data is initially true and is marked false after user reviews it
database.Update(s) }
}
Thanks,
Prava