예제 #1
0
        public void dropdown1()
        {
            ab1.Clear();
            SqlCommand    a  = new SqlCommand("select * from Hostel", Connection.get());
            SqlDataReader aa = a.ExecuteReader();

            while (aa.Read())
            {
                Hostel ao = new Hostel()
                {
                    Building_ID = (int)aa[0]
                };
                ab1.Add(ao);
            }
            aa.Close();
        }
예제 #2
0
        public Hostel UpItems(int Building_ID)
        {
            string        q   = "Select * from Hostel Where Building_ID =" + Building_ID;
            SqlCommand    sc  = new SqlCommand(q, Connection.get());
            SqlDataReader sdr = sc.ExecuteReader();
            Hostel        u   = new Hostel();

            while (sdr.Read())
            {
                u.Building_ID       = (int)sdr["Building_ID"];
                u.Students_Residing = (int)sdr["Students_Residing"];
                u.Students_Residing = (int)sdr["Students_Residing"];
                u.Annual_Expenses   = (int)sdr["Annual_Expenses"];
                u.Address           = (string)sdr["Address"];
                u.City          = (string)sdr["City"];
                u.Building_Name = (string)sdr["Building_Name"];
            }
            sdr.Close();
            return(u);
        }
예제 #3
0
        public List <Hostel> ShowAll()
        {
            string        q   = "Select * from Hostel";
            SqlCommand    sc  = new SqlCommand(q, Connection.get());
            SqlDataReader sdr = sc.ExecuteReader();
            List <Hostel> lst = new List <Hostel>();

            while (sdr.Read())
            {
                Hostel u = new Hostel();
                u.Building_ID       = (int)sdr["Building_ID"];
                u.Students_Residing = (int)sdr["Students_Residing"];
                u.Students_Residing = (int)sdr["Students_Residing"];
                u.Annual_Expenses   = (int)sdr["Annual_Expenses"];
                u.Address           = (string)sdr["Address"];
                u.City          = (string)sdr["City"];
                u.Building_Name = (string)sdr["Building_Name"];
                lst.Add(u);
            }
            sdr.Close();
            return(lst);
        }