Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exception of type System.StackOverflowException was thrown

Status
Not open for further replies.

Stoemp

Programmer
Sep 25, 2002
389
BE
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top