Z
Zaczyk, Joe
I want to kow which one is faster out of these two examples. (Select or
Dataview)
This is just an example.
Dim FilterCondition As String = ""
Dim Dt As DataTable
dt = da.Fill(dt) 'Query=Select EmpID, EmpName, ReportingTo from EMP
Dim row As DataRow
Dim rowEmp As DataRow
Example 1
===========
For Each rowEmp In dt.Rows
FilterCondition = "ReportingTo=" & rowEmp("EmpID")
If dt.Select(FilterCondition).Length > 0 Then
For Each row In dt.Select(FilterCondition)
'TODO
Next
End If
Next
Example 2
=========
For Each rowEmp In dt.Rows
FilterCondition = "ReportingTo=" & rowEmp("EmpID")
Dim dv As DataView = New DataView(dt, FilterCondition, "",
DataViewRowState.OriginalRows)
If dv.Count > 0 Then
For Each row In dv
'TODO
Next
End If
Next
Again, This is just an example to explain my question.
Thanks,
Joe
Dataview)
This is just an example.
Dim FilterCondition As String = ""
Dim Dt As DataTable
dt = da.Fill(dt) 'Query=Select EmpID, EmpName, ReportingTo from EMP
Dim row As DataRow
Dim rowEmp As DataRow
Example 1
===========
For Each rowEmp In dt.Rows
FilterCondition = "ReportingTo=" & rowEmp("EmpID")
If dt.Select(FilterCondition).Length > 0 Then
For Each row In dt.Select(FilterCondition)
'TODO
Next
End If
Next
Example 2
=========
For Each rowEmp In dt.Rows
FilterCondition = "ReportingTo=" & rowEmp("EmpID")
Dim dv As DataView = New DataView(dt, FilterCondition, "",
DataViewRowState.OriginalRows)
If dv.Count > 0 Then
For Each row In dv
'TODO
Next
End If
Next
Again, This is just an example to explain my question.
Thanks,
Joe