Imports System.Data
Imports System.Data.SqlClient

Public Class BL

#Region "Methoden"
    Public Function HoleSortenListe() As List(Of Kurs)
        Dim lstKurse As New List(Of Kurs)
        Using conVerbindung As New SqlConnection(My.Settings.strConString)
            Dim cmdKurse As New SqlCommand("SELECT id FROM kurse", conVerbindung)
            conVerbindung.Open()

            Dim rdKurse As SqlDataReader = cmdKurse.ExecuteReader()
            ' Solange der Reader Daten liefert...
            While rdKurse.Read()
                Dim intID As Integer
                intID = rdKurse("id")
                ' ... Kurs zur ID instanziieren
                Dim ksKurs As Kurs
                ksKurs = New Kurs(intID)
                ' und der Liste hinzufügen
                lstKurse.Add(ksKurs)
            End While

            Return lstKurse
        End Using
    End Function
#End Region

End Class
