Beispiel #1
0
        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 GetSchoolYearList()
        {
            try
            {
                string RetrieveQuery = "SELECT [SCHOOL YEAR] FROM [Tbl.SchoolYear]";
                sqlcommand = new SqlCommand(RetrieveQuery, sqlconnection);
                SqlDataReader sqldatareader = sqlcommand.ExecuteReader();

                while (sqldatareader.Read())
                {
                    SchoolYearDropdown.AddItem(sqldatareader.GetString(0));
                }
                sqldatareader.Close();
                SchoolYearDropdown.selectedIndex = 0;
            }

            catch (Exception)
            {
                //DO NOTHING SHIT !
            }
        }