Hi,
The find method will find a data row based on a primary key. The
primary key can be based on more than one column. If you set the primary key
equal to the 2 columns you will get an error if you try to add a duplicate
entry.
http://msdn.microsoft.com/library/de...rykeytopic.asp
http://msdn.microsoft.com/library/de...sFindTopic.asp
Ken
----------------------
"Brad" <(E-Mail Removed)> wrote in message
news:eZo4gh%(E-Mail Removed)...
I need a routine that runs through the current datatable to check for a
duplicate entry using two columns. When I set an array variable to object
and then set each variable's data to find, does the find method search for
var1 or var2, or var1 AND var2? I need it to include any rows that contain
both of these variables.
Here is code that I am using if it might help. If there is another way of
doing this, I am open to suggestions.
Thanks for the information.
Dim foundRow As DataRow
Dim findThese(1) As Object
findThese(0) = dtpEventDate.Value
If cmbShowTrial.SelectedText <> "" Then findThese(1) =
cmbShowTrial.SelectedText Else findThese(1) = ""
foundRow = DsConformation1.Tables(0).Rows.Find(findThese)
If Not (foundRow Is Nothing) Then 'row is found
MsgBox("This entry has already been made")
Exit Sub
End If