1 回答

TA贡献1921条经验 获得超9个赞
试试这个方法。我不确定你的 sqlite 代码是如何工作的,所以我只是在这里猜测。我还猜测您想检查新创建的记录是否存在,因此此代码基于此。
conn.CreateTable<Record>();
//check if records exist
var items = conn.Table<Record>().Where(array => array.Jobno == photo.Jobno && array.Applicationletter == photo.Applicationletter && array.Signno == photo.Signno);
if (items?.Count() == 0)
{
var numberofrows = conn.Insert(record);
if (numberofrows > 0)
{
DisplayAlert("Success", "record has been saved successfully", "Ok");
MainImage.Source = " ";
}
else
{
DisplayAlert("Failure", "Error occoured while saving record", "Try again");
}
}
else
{
DisplayAlert("Failure", "Photo already exist", "ok");
}
//clear the notes field
notesentry.Text = "";
- 1 回答
- 0 关注
- 108 浏览
添加回答
举报