Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need some some with a queryfilter whereclause that is giving me a headache.. All it does is convert the search to uppercase and preform 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 way including

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

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

But it cant find the record.

What am I doing wrong?

Thanks

share|improve this question

closed as off topic by underdark Oct 12 '12 at 17:34

Questions on Geographic Information Systems Stack Exchange are expected to relate to geographic information systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Just tried the following

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

and got it working.

share|improve this answer

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