2

I need help with a queryFilter WHERE clause that is giving me a headache.

All it does is to convert the search to uppercase and perform the search whether the result is uppercase or not (e.g. it will find "Jones" or JONES").

I have the following code in my VBA app:

Dim pQF as IQueryFilter
Set pQF = new QueryFilter
pQF.WhereClause = "upper(" & strFieldToSearch &") LIKE '%" & UCase(Replace(strSearch,"'","''")) & "%'"

In my C# code I have tried various ways including:

queryFilter.WhereClause =  searchField + " LIKE '%" + search.Replace("'","''") + "%'";

queryFilter.WhereClause = strSearchField.ToUpper() + " LIKE " + "'%" + strSearch.ToUpper() + "%'";

But it can't find the record. What am I doing wrong?

1 Answer 1

2

Just tried the following

queryFilter.WhereClause = "upper(" + strSearchField + ") LIKE'%" + strSearch.ToUpper() + "%'";

and got it working.

Not the answer you're looking for? Browse other questions tagged or ask your own question.