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 關注
- 138 瀏覽
添加回答
舉報