private void Retrieve_School_Year_List_And_ID() { try { string sqlquery1 = "SELECT [ENTRY ID], [SCHOOL YEAR] FROM [Tbl.SchoolYear]"; sqlcommand = new SqlCommand(sqlquery1, sqlconnection); SqlDataReader sqldatareader = sqlcommand.ExecuteReader(); while (sqldatareader.Read()) { SchoolYearIDDropdown.AddItem(sqldatareader.GetString(0)); SchoolYearDropdown.AddItem(sqldatareader.GetString(1)); CurrentSchoolYearDropdown.AddItem(sqldatareader.GetString(1)); } sqldatareader.Close(); SchoolYearIDDropdown.selectedIndex = 0; SchoolYearDropdown.selectedIndex = 0; CurrentSchoolYearDropdown.selectedIndex = 0; } catch (Exception) { //DO NOTHING SHIT ! } }
private void RetrieveSchoolYearList() { try { string localvariablestring = "SELECT [CURRENT SCHOOL YEAR] FROM [Tbl.CurrentSchoolYear]"; sqlcommand = new SqlCommand(localvariablestring, sqlconnection); SqlDataReader sqldatareader = sqlcommand.ExecuteReader(); while (sqldatareader.Read()) { CurrentSchoolYearDropdown.AddItem(sqldatareader.GetString(0)); } CurrentSchoolYearDropdown.selectedIndex = 0; sqldatareader.Close(); } catch (Exception) { //DONT DISPLAY ANYTHING SHIT ! } }