Xamarin SQLite.Net更新生成错误“;它没有PK“;
我正在使用Xamarin的PCL中使用Lync语法Xamarin SQLite.Net更新生成错误“;它没有PK“;,xamarin,sqlite-net,Xamarin,Sqlite Net,我正在使用Xamarin的PCL中使用Lync语法 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 Cre
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)
}
记录“s”是否有PK集,还是为空?它显示0,只有一条记录。我刚刚做了一个var s=database.Table();查看IntelisSense,PK属性设置为null,HasAutoIncPK=false。看起来它忽略了属性…有什么想法吗?你能解决这个问题吗?@f谢谢
[SQLite.PrimaryKey, SQLite.AutoIncrement]