SeekToPrimaryKey


Author
Message
Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

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

 

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Right you are, Larry BigGrin

I'll get the "=" changed to "&="

Thanks for the heads up.

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
It's been fixed... and will be in the release with the DevExpress wrapper probably next week.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Ben,

That's great. I can work around the issue till then.

Thanks,

-Larry

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, you can even change your source code and then recompile it, if you need to.  There's a batch file that will automatically register the recompiled DLLs in the GAC and copy them to the Program Files\Common Files\MicroFour\StrataFrame\ folder.
Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
Ben,

Thanks for the tip. I found the afterbuild.bat file in "Program Files\MicroFour\StrataFrame Source Code\"

-Larry

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No problem.  We distribute that file so if you want/need to make source code changes, you don't have to worry about registering your new DLLs in the GAC every time.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search