I'm writting a UWP app, using SQLite.Net-PCL package to access a database. I have a table with a compound key:
[Table("Rels")]
public class Rel
{
[PrimaryKey]
public int Sup { get; set; }
[PrimaryKey]
public int Sub { get; set; }
public int Val { get; set; }
}
When i try to update it, exception is thrown. The only information given in the exception is a word "Constraint".
Rel r = new Rel() { Sup = 0, Sub = 2, Val = 2 };
db.Execute("update rels set val=2 where sup=0 and sub=2"); //works
db.Update(r); //this does not work.. "Constraint" exception
Another table, having a single field PK, updates ok. What am i doing wrong? Please help. Thanks!
Aucun commentaire:
Enregistrer un commentaire