public void dropdown1() { ab1.Clear(); SqlCommand a = new SqlCommand("select * from S_Allocation", Connection.get()); SqlDataReader aa = a.ExecuteReader(); while (aa.Read()) { S_Allocation ao = new S_Allocation() { Allocation_ID = (int)aa[0] }; ab1.Add(ao); } aa.Close(); }
public S_Allocation UpItem(int Allocation_ID) { string q = "Select * from S_Allocation Where Allocation_ID =" + Allocation_ID; SqlCommand sc = new SqlCommand(q, Connection.get()); SqlDataReader sdr = sc.ExecuteReader(); S_Allocation u = new S_Allocation(); while (sdr.Read()) { u.Allocation_ID = (int)sdr["Allocation_ID"]; u.S_ID = (int)sdr["S_ID"]; u.Room_ID = (int)sdr["Room_ID"]; u.Start_Date = (string)sdr["Start_Date"]; u.End_Date = (string)sdr["End_Date"]; } sdr.Close(); return(u); }
public List <S_Allocation> ShowAll() { string q = "Select * from S_Allocation"; SqlCommand sc = new SqlCommand(q, Connection.get()); SqlDataReader sdr = sc.ExecuteReader(); List <S_Allocation> lst = new List <S_Allocation>(); while (sdr.Read()) { S_Allocation u = new S_Allocation(); u.Allocation_ID = (int)sdr["Allocation_ID"]; u.S_ID = (int)sdr["S_ID"]; u.Room_ID = (int)sdr["Room_ID"]; u.Start_Date = (string)sdr["Start_Date"]; u.End_Date = (string)sdr["End_Date"]; lst.Add(u); } sdr.Close(); return(lst); }