M
mikezcg
i am trying to speed up my code. i have commented old parts out, but
leave them there for information. I have tried a data adapter and
that is slower. The process is taking 10seconds, i would like to
atleast half it any ideas? :
Private Function CreateTblFromDR(ByVal dr As OleDbDataReader, ByVal
dt As DataTable) As DataTable ', ByVal overloadParam As String
Dim drow As DataRow
Dim Index As Integer
'Dim i, CkNo, InvDate, Deal, InvNo, InvAmt, ref, comment As
Integer
'InvDate = 0 InvAmt = 1 Deal = 2 InvNo = 3 ref = 4 CkNo = 5
comment = 6
dt.Clear()
Dim counter As Integer = dr.FieldCount - 1
Dim aobjFields(counter) As Object
Do While dr.Read
drow = dt.NewRow
dr.GetValues(aobjFields)
For Index = 0 To counter
On Error Resume Next
drow(Index) = CStr(aobjFields(Index))
Next
dt.Rows.Add(drow)
On Error GoTo 0
Loop
Return dt
End Function
leave them there for information. I have tried a data adapter and
that is slower. The process is taking 10seconds, i would like to
atleast half it any ideas? :
Private Function CreateTblFromDR(ByVal dr As OleDbDataReader, ByVal
dt As DataTable) As DataTable ', ByVal overloadParam As String
Dim drow As DataRow
Dim Index As Integer
'Dim i, CkNo, InvDate, Deal, InvNo, InvAmt, ref, comment As
Integer
'InvDate = 0 InvAmt = 1 Deal = 2 InvNo = 3 ref = 4 CkNo = 5
comment = 6
dt.Clear()
Dim counter As Integer = dr.FieldCount - 1
Dim aobjFields(counter) As Object
Do While dr.Read
drow = dt.NewRow
dr.GetValues(aobjFields)
For Index = 0 To counter
On Error Resume Next
drow(Index) = CStr(aobjFields(Index))
Next
dt.Rows.Add(drow)
On Error GoTo 0
Loop
Return dt
End Function