SeekToPrimaryKey and NavigateToPrimaryKey do not appear to be working properly for compound primary keys. Looking at the source code I believe there is a bug in Private Function GetIndexOfPrimaryKey.
Private Function GetIndexOfPrimaryKey(ByVal ParamArray PrimaryKeyValues As Object()) As Integer
'-- Establish locals
Dim lnReturn As Integer = -1
Dim lnCnt As Integer
Dim loRow As DataRow
Dim lcSelect As String = String.Empty
'-- Make sure the length of the primary key values and the length of the fields matches
If Me.PrimaryKeyFields.Length <> PrimaryKeyValues.Length Then
Throw New ArgumentException("The number of PrimaryKeyValues passed must match the number of PrimaryKeyFields on the business object.")
End If
'-- Find the row
Try
'-- Create the primary key string
For lnCnt = 0 To Me.PrimaryKeyFields.Length - 1
'-- Add the "AND" if necessary
If lnCnt > 0 Then
lcSelect &= " AND "
End If
'-- Add the select value
lcSelect = Me.PrimaryKeyFields(lnCnt) & "='" & PrimaryKeyValues(lnCnt).ToString() & "'"
Next
When there is more than 1 primary key field, the previous value of lcSelect gets over written. Changing the statement under “‘—Add the select value” to the following should fix the problem.
lcSelect = lcSelect & Me.PrimaryKeyFields(lnCnt) & "='" & PrimaryKeyValues(lnCnt).ToString() & "'"
-Larry