Hi,
I'm making an asp website as part of a work for school. I have a class in which I try to get all the news messages from an access database. I receive a datatable from my database with two items in it, the right number of news messages in my database. Then I try to run through the different datarows in the datatable to add the information to a HashTable. When I do this, I get this stackoverflowexception. I looked this up and the docs say this occurs in huge recursion functions, but I don't use recursion here.
I use the following code:
Public ReadOnly Property Nieuws() As Hashtable
Get
Dim hshNieuws As New Hashtable()
Dim sSQL As String
sSQL = "Select * from nieuws Order by Datum"
Dim DT As DataTable
DT = Me.Connection.GetDT(sSQL)
Dim DR As DataRow
Dim oNieuws As clsNieuws
For Each DR In DT.Rows
oNieuws = New clsNieuws(DR.Item("nieuwsID", Me)
hshNieuws.Add(oNieuws.id, oNieuws)
Next
Return hshNieuws
End Get
End Property
I receive the right datatable from the database in the line:
DT = Me.Connection.GetDT(sSQL)
So this is not the problem. The error occurs while or after executing the add-instruction. I put breakpoints there and the overflow happens after jumping over that line.
Can someone help me please?
Thanks,
Steven
I'm making an asp website as part of a work for school. I have a class in which I try to get all the news messages from an access database. I receive a datatable from my database with two items in it, the right number of news messages in my database. Then I try to run through the different datarows in the datatable to add the information to a HashTable. When I do this, I get this stackoverflowexception. I looked this up and the docs say this occurs in huge recursion functions, but I don't use recursion here.
I use the following code:
Public ReadOnly Property Nieuws() As Hashtable
Get
Dim hshNieuws As New Hashtable()
Dim sSQL As String
sSQL = "Select * from nieuws Order by Datum"
Dim DT As DataTable
DT = Me.Connection.GetDT(sSQL)
Dim DR As DataRow
Dim oNieuws As clsNieuws
For Each DR In DT.Rows
oNieuws = New clsNieuws(DR.Item("nieuwsID", Me)
hshNieuws.Add(oNieuws.id, oNieuws)
Next
Return hshNieuws
End Get
End Property
I receive the right datatable from the database in the line:
DT = Me.Connection.GetDT(sSQL)
So this is not the problem. The error occurs while or after executing the add-instruction. I put breakpoints there and the overflow happens after jumping over that line.
Can someone help me please?
Thanks,
Steven