C
Charles Law
I have a data table with ~1000 rows. I go through the rows one at a time,
checking the contents. If I find a cell with an error, e.g containing null,
I use SetColumnError on the data row to flag it.
Here's my code:
For Each dr As DataRow In MyDataTable.Rows
Dim MyValue As Integer
If dr("ID").Equals(DBNull.Value) Then
dr.SetColumnError("ID", "ID cannot be null") ' this take 1 to 2
seconds each time
Else
MyValue = CType(dr("ID"), Integer)
End If
...
Next
The problem is each call to SetColumnError takes about 1-2 seconds to
execute. This is an ice-age, and if I have 100 cells to flag it takes 100
seconds to go through the data.
Does anyone know why it takes so long for this method to execute?
I am using VS2008 SP1 on XP SP3. I am targeting V3.5 of the framework,
although I have V3.5 SP1 installed. This was a problem before I installed
SP1 though. The back-end is SQL Server 2005, but the data are disconnected,
so I can't see that being an issue.
TIA
Charles
checking the contents. If I find a cell with an error, e.g containing null,
I use SetColumnError on the data row to flag it.
Here's my code:
For Each dr As DataRow In MyDataTable.Rows
Dim MyValue As Integer
If dr("ID").Equals(DBNull.Value) Then
dr.SetColumnError("ID", "ID cannot be null") ' this take 1 to 2
seconds each time
Else
MyValue = CType(dr("ID"), Integer)
End If
...
Next
The problem is each call to SetColumnError takes about 1-2 seconds to
execute. This is an ice-age, and if I have 100 cells to flag it takes 100
seconds to go through the data.
Does anyone know why it takes so long for this method to execute?
I am using VS2008 SP1 on XP SP3. I am targeting V3.5 of the framework,
although I have V3.5 SP1 installed. This was a problem before I installed
SP1 though. The back-end is SQL Server 2005, but the data are disconnected,
so I can't see that being an issue.
TIA
Charles