haseebhm
Member
- Joined
- Jul 13, 2009
- Messages
- 6
My clients upload excel sheets to the software which need to be validates. One of the validation steps is to check the sheet for duplicate records. The following code demonstrates the method I use to make this possible.
But this makes the validation process very very slow.Please suggest me other(faster) ways to do the same job. Thanks in advance.
I am using VB .NET 2008
Code:
For i = 0 To xlDtSet.Tables(0).Rows.Count - 1
xlCommand2 = New System.Data.OleDb.OleDbDataAdapter("select [COL1], [COL2] from [Sheet1$] WHERE [COL1]=" & xlDtSet.Tables(0).Rows(i).Item("COL1"), xlConnection)
xlCommand2.Fill(xlDtSet2)
If xlDtSet2.Tables(0).Rows.Count > 1 Then
LOG ERROR
MsgBox("DUPLICATE")
End If
xlDtSet2.Clear()
Next
But this makes the validation process very very slow.Please suggest me other(faster) ways to do the same job. Thanks in advance.
I am using VB .NET 2008