private void buttonSave_Click(object sender, EventArgs e) { Nominant nominant = new Nominant { name = textBoxName.Text, nominations = int.Parse(textBoxNominations.Text), oscars = int.Parse(textBoxOscars.Text) }; ControlDb.Add(nominant); Thread.Sleep(500); this.Close(); }
public static void getAllSeries(int from, int to, string channels) { string commandGetAllSeries = string.Format("SELECT * FROM Series WHERE(completed_seasons BETWEEN {0} AND {1}) AND(TV_Channel IN({2}))", from, to, channels); SqlCommand selectSeries = new SqlCommand(commandGetAllSeries, GetConnection()); SqlDataReader sqlReader = selectSeries.ExecuteReader(); if (sqlReader.HasRows) { while (sqlReader.Read()) { Nominant newNominant = new Nominant { }; } } }
public static BindingList <Nominant> SelectAll() { BindingList <Nominant> getNominants = new BindingList <Nominant>(); string commandSelectAll = "Select * from nominats"; SqlCommand selectInfo = new SqlCommand(commandSelectAll, GetConnection()); SqlDataReader sqlReader = selectInfo.ExecuteReader(); if (sqlReader.HasRows) { while (sqlReader.Read()) { Nominant newNominant = new Nominant { name = sqlReader.GetValue(0).ToString(), nominations = (int)sqlReader.GetValue(1), oscars = (int)sqlReader.GetValue(2) }; getNominants.Add(newNominant); } } return(getNominants); }