hi all.i would like to know, why datatable.select(condition), sometimes it found records, but sometimes not found a record.
here this is an example of my datatable:

ID itemID
1 2
1 3
1 1
1 4
1 2 I don't want this record
2 3
2 4
2 1
2 3 I don't want this record too.

I would like to insert without a duplicate value.

and here is my datatable.select function(purpose of the function is to search)

Code:
    Private Function SearchDataTable(ByVal dt As DataTable, ByVal condition As String) As Integer
        Dim ReturnValue As Integer
        ReturnValue = dt.Select(condition).Length
        Return ReturnValue
    End Function

    Private sub cmd_Click()
           if searchdatatable(dt, "id=" & id & " and ItemID=" & txtItemID.text)=0 then
             ........
             ........
             ........
           End If
          ........
          ........
          ........
    End Sub

anyidea please, many thank for your help.