StrataFrame Forum

Business Layer Bug

http://forum.strataframe.net/Topic26310.aspx

By Larry Caylor - 3/5/2010

I'm using a browse dialog with a view. In order to be able to select a record from the results I've defined a primary key on the view that is made up of two character fields in the view; Case# and CaseLastName. This combination gives me a unique key. The issue I'm running into is that CaseLastName may contain a single quote (e.g. O'REILLY). When this happens I get an error message saying "Syntax error: Missing operand after 'REILLY' operator."

I've traced the problem to following line (2845) in BusinessLayer.vb

lcSelect &= Me.PrimaryKeyFields(lnCnt) & "='" & PrimaryKeyValues(lnCnt).ToString & "'"

I'd like to suggest the following fix to take into account that a character primary key may contain single quotes. I've added the fix locally and so far it's solved my problem and doesn't appear to introduce any other issues.

lcSelect &= Me.PrimaryKeyFields(lnCnt) & "='" & CStr(PrimaryKeyValues(lnCnt)).Replace("'", "''") & "'"

 

By Trent L. Taylor - 3/8/2010

Fixed and in the next build. Thanks for the suggestion. Smile