I'm trying to create a simple Notes app with Xamarin forms. I have Entrys, a Date and then a switch to determine if the note is done or not.
When creating a new note everything works fine with inserting the data. But when I try to update a note the Switch Element always inserts as "false", the other data works with the update. I have no idea what the problem might be?
Here is the method for updating the note:
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 + "'");
}
And here is the click event from the Views code behind:
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();
};