嗨,我有以下功能:
Public Shared Function GetAbrechnung() As List(Of WochenBPlan)
Dim wbp = New WochenBPlan
Dim allBookings As List(Of WochenBPlan) = New List(Of WochenBPlan)
Dim strSQL As String = "SELECT DISTINCT d.ABTEILUNG, d.BEMERKUNG, d.BESTUHLUNG, d.RAUMID, d.ID, d.PERSONENZAHL, d.ADRESSE + ', ' + d.RAUMBEZEICHNUNG AS RAUMBEZEICHNUNG, d.THEMA, p.VN + ' ' + p.NN AS NAME, CONVERT (char(5), d.VON, 108) + ' - ' + CONVERT (char(5), d.BIS, 108) AS ZEIT, p.TEL FROM VIEW_RAUMBUCHUNG_DISPO AS d INNER JOIN PERSONAL AS p ON d.PERSONAL_ID = p.ID WHERE THEMA = 'EVENT'"
Dim objRS As SqlDataReader
objRS = SQLrunReaderWB(strSQL)
If objRS.HasRows Then
While objRS.Read()
wbp.Raum = objRS("RAUMBEZEICHNUNG")
wbp.Zeit = objRS("ZEIT")
If Not IsDBNull(objRS("ABTEILUNG")) Then
wbp.Bereich = objRS("ABTEILUNG")
End If
If Not IsDBNull(objRS("THEMA")) Then
wbp.Thema = objRS("THEMA")
End If
If Not IsDBNull(objRS("NAME")) Then
wbp.Mieter = objRS("NAME")
End If
If Not IsDBNull(objRS("TEL")) Then
wbp.Mieter_Tel = objRS("TEL")
End If
wbp.Personen = objRS("PERSONENZAHL")
wbp.Bestuhlung = objRS("BESTUHLUNG")
If Not IsDBNull(objRS("BEMERKUNG")) Then
wbp.Bemerkung = objRS("BEMERKUNG")
End If
allBookings.Add(wbp)
End While
Else
End If
ConnWB.Close()
Return allBookings
End Function
我的问题是我生成的列表只是返回最后一个值。我在做什么错?有人可以帮忙吗?