I have some very simple code that is used to Import data from various files in my database via a .net web application. During my recent updating of this code to make some centralise function calls I ran into a situation where I try to Add a data row to a data table and this crashes or better yet restart the applicaton pool. I noticed that the application wasnt throwing any exception but would just kill my session. I took a look at the event Viewer and saw that my App pool was suffering from a stackoverflow exception. Here is a snippet of code that is causing the issue.
'build the template datatable
Dim XYZDataTable As New DataTable
BuildDataTable(XYZDataTable, "XYZ", Template_Id)
'Get data from filedata to populate template table
For Each dr As DataRow In dt.Rows
Dim row As DataRow = XYZDataTable.NewRow()
row("Order Number") = dr("Order Number")
row("TRACKING NUMBER") = dr("TRACKING NUMBER")
row("USPS CHARGE") = dr("USPS CHARGE")
row("Carrier ID") = GetCarrierID(dr("TRACKING NUMBER"))
'Add the row to the datatable
XYZDataTable.Rows.Add(row)
Next
Return XYZDataTable
When I remove the Charges column it works fine, Has anyone every had an issue like this and how did you solve it.
I am not get the original data from a database but from an xls file. I want to then insert that Data into the database, but before I want to clean up the data a bit so I need it a datatable to I can manage the columns I want.