ok this is the thing I have right now which is working quite well beside its a bit slow:
Public Function GetList() As List(Of SalesOrder)
Try
Dim list As New List(Of SalesOrder)
Dim ds As DataSet
ds = cls.GetSalesOrd erList 'CLS is the data access class
For i = 0 To ds.Tables(0).Ro ws.Count - 1
Dim row As DataRow = ds.Tables(0).Ro ws(i)
Dim kk As SalesOrder = New SalesOrder()
kk.ID = Val(row.Item("i d") & "")
kk.SalesOrderNo = row.Item("sales orderid") & ""
kk.SalesOrderDa te = row.Item("Order Date") & ""
kk.CustomerId = Val(row.Item("c ustomerid") & "")
list.Add(kk)
Next
Return list
Catch ex As Exception
Throw ex
End Try
End Function
Now once I start retrieving more than 10000 records from the table, the loop takes long time to load values into generic class. Is there any way that I can get rid of loop? Can I do something like the following with the generic class?
txtSearch.AutoC ompleteCustomSo urce.AddRange(A rray.ConvertAll (Of DataRow, String)(Busines sLogic.ToDataTa ble.ConvertTo(W orkOrderList).S elect(), Function(row As DataRow) row("TradeConta ctName")))
Public Function GetList() As List(Of SalesOrder)
Try
Dim list As New List(Of SalesOrder)
Dim ds As DataSet
ds = cls.GetSalesOrd erList 'CLS is the data access class
For i = 0 To ds.Tables(0).Ro ws.Count - 1
Dim row As DataRow = ds.Tables(0).Ro ws(i)
Dim kk As SalesOrder = New SalesOrder()
kk.ID = Val(row.Item("i d") & "")
kk.SalesOrderNo = row.Item("sales orderid") & ""
kk.SalesOrderDa te = row.Item("Order Date") & ""
kk.CustomerId = Val(row.Item("c ustomerid") & "")
list.Add(kk)
Next
Return list
Catch ex As Exception
Throw ex
End Try
End Function
Now once I start retrieving more than 10000 records from the table, the loop takes long time to load values into generic class. Is there any way that I can get rid of loop? Can I do something like the following with the generic class?
txtSearch.AutoC ompleteCustomSo urce.AddRange(A rray.ConvertAll (Of DataRow, String)(Busines sLogic.ToDataTa ble.ConvertTo(W orkOrderList).S elect(), Function(row As DataRow) row("TradeConta ctName")))
Comment