public void AddStudentLunchChoices(StudentLunchChoice studentLunchChoice) { dbconn.Open(); dbcmd = dbconn.CreateCommand(); dbcmd.CommandText = "INSERT INTO studentlunchchoices VALUES(date(), " + studentLunchChoice.lunchChoice.lunchChoiceID + ", " + studentLunchChoice.amountOfLunches + ", \"" + studentLunchChoice.userAddedBy + "\");"; Debug.Log(dbcmd.CommandText); dbcmd.ExecuteScalar(); dbcmd.Dispose(); dbconn.Close(); }
public void SaveButtonClicked() { StudentLunchChoice newLunchChoice = new StudentLunchChoice(selectedLunchChoice, DataBase.Instance.activeUser.username, int.Parse(lunchChoiceAmountInput.text)); int value; if (!int.TryParse(lunchChoiceAmountInput.text, out value)) { Debug.Log("Input is invalid"); return; } DataBase.Instance.AddStudentLunchChoices(newLunchChoice); }