Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...