【发布时间】:2016-08-10 10:55:44
【问题描述】:
我正在尝试使用 Xamarin 表单创建一个简单的 Notes 应用程序。我有条目,一个日期,然后是一个开关来确定笔记是否完成。
创建新笔记时,插入数据一切正常。但是当我尝试更新注释时,开关元素始终插入为“false”,其他数据适用于更新。我不知道问题可能是什么?
更新笔记的方法如下:
public void UpdateNote(string _name, string _note, string _date, bool _done, int noteId)
{
_sqlconnection.Query<Notes>("UPDATE [Notes] SET Name='" + _name + "', Note='" + _note + "', Date='" + _date + "', Done='" + _done + "' WHERE [ID]='" + noteId + "'");
}
下面是 Views 代码背后的点击事件:
UpdateClick.Clicked += delegate {
_notes = new Notes();
_notesDb = new NotesDB();
_notes.Name = name.Text;
_notes.Note = note.Text;
_notes.Date = DateTime.Now.ToString();
_notes.Done = done.IsToggled;
_notesDb.UpdateNote(_notes.Name, _notes.Note, _notes.Date, _notes.Done, noteId);
Navigation.PopAsync();
};
【问题讨论】:
标签: c# sqlite xaml xamarin xamarin.forms