public void fillCombo(ComboBox combo, string inf) { string sqlDa = ""; DBhandling dbcmd = new DBhandling(); List <string> subjects = new List <string>(); switch (inf) { case "emne": sqlDa = "SELECT enme_Name FROM Emner;"; subjects = dbcmd.readDBNumUn(sqlDa, "enme_Name"); break; case "genre": sqlDa = "SELECT genre_Name FROM Genre;"; subjects = dbcmd.readDBNumUn(sqlDa, "genre_Name"); break; case "type": sqlDa = "SELECT type_Name FROM MedieType;"; subjects = dbcmd.readDBNumUn(sqlDa, "type_Name"); break; case "postnr": sqlDa = "SELECT postNr_ID, city FROM PostnummerBy;"; subjects = dbcmd.readDBNumUn(sqlDa, "postNr_ID"); break; } foreach (string s in subjects) { combo.Items.Add(s); } }
public void fillEmner() { DBhandling dbcmd = new DBhandling(); List <string> emner = new List <string>(); string sqlDa = "SELECT enme_Name FROM Emner;"; emner = dbcmd.readDBNumUn(sqlDa, "enme_Name"); combo_SeekType.Items.Add("Søg i alle"); foreach (string s in emner) { combo_SeekType.Items.Add(s); } }