我有c#android应用程序。我有一个表单,其中包含一些字段jobno,route,cost,当用户填写表单并按保存时,信息将存储在appite中的SQLite数据库中。
我想要什么……
试试这个方法。我不确定你的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 = "";