Hi all,
I have a variety of different Shapefiles/SDE Featureclasses/File GDB Featureclasses which I need to perform attribute queries on. I need to develop a way which will ignore the varierty of case types present in these data sources. Currently I have used the following which do work.
pQF.WhereClause = "UPPER(" & pField & ") = '" & pSearchText.ToUpper & "'"
This works but performance is decreased as this ignores field indexing on the data.
pQF.WhereClause = pField & " = '" & pSearchText.ToUpper & "' OR " & pField & " = '" & pSearchText.ToLower & "' OR " & pField & " = '" & StrConv(pSearchText, VbStrConv.ProperCase) & "'"
This also works but again it does not perform well, I guess because it has to search the a number of times for the different cases. My question is: Is there a faster way to implement case insensitivity (I am not able to 'clean' the data)?
Thanks muchly in advance.
Gino
Honestly I really don't know what is the problem? Where clauses are not case sensitive: I'm using few of them in my code and there is 0 problem with executing or performance. I've created a simple method to create a where clauses for spatial filters:public string CreateQuery(string fieldName, string value, bool isFieldTypeString)
{
string query = "";
if (isFieldTypeString == true)
query = String.Format("{0} = '{1}'", fieldName, queryValue);
else
query = String.Format("{0} = {1}", fieldName, queryValue);
return query;
}
That's all -> I did some testing and there is no problem with queries like this:1. OBJECTID = 102. objectid = 104. OBjECTID = 10 (try them in arcmap manually and you will see)Or maybe I've just misunderstood your problem?regards