Opened 11 years ago

#1048 new defect

CT Throws an Error When the string in the Lookup Picker includes a hard bracket [ or ]

Reported by: Martin Reisinger Owned by: Pete Cyr
Priority: medium Milestone: Post 1.0
Component: Curator Tool Version: 1.9.6.41 CT
Severity: Keywords: lookup picker
Cc: Database Engine: N/A
Operating System: N/A

Description

per Martin Bilek

We encountered an error while editing row in CuratorTool using LookupPicker. As you can see in enclosed picture, there is an unhandled exception in System.Data.LikeNode.AnalyzePattern. This error occurred only in case, when string include [ or ] character. I think, that error is in GRINGlobal.Client.Common.LookupTablePicker.RefreshList function in line:

_boundTable.DefaultView.RowFilter = rowFilter.Replace("@displaymember + '%'", "'" + ux_textboxFind.Text.Replace("'", "") + "%'");

where I think, that you may replace "[" with "]" and "]" with "[".

Previous statements are running correctly, because on SQL I saw query:

exec sp_executesql N' SET FMTONLY OFF; SET NO_BROWSETABLE ON;SELECT TOP 1000 * FROM crop_trait_code_lookup WHERE crop_trait_id=
41469 AND display_member like @displaymember + % ORDER BY display_member ASC',N'@displaymember nvarchar(4000)',@displaymember=N

Something like this is discussed in ​http://stackoverflow.com/questions/8754120/getting-error-in-fetching-data-from-datatables-select-method-using-like-opera

...could be fixed by making the CT replace square brackets before using them in a LIKE operator.

Change History (0)

Note: See TracTickets for help on using tickets.