开发者

Updating a Row in a DataTable crashes IIS app Pool

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.


Can you check if you are actually passing that column and row from the database to the c# application ?. It looks like that column is not getting passed and that is what is causing the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜