QueryFilter to match Guids

478
2
10-11-2011 06:58 AM
AndrewCorcoran
New Contributor III
I'm having absolutely no luck trying to get FeatureDataRow or FeatureDataReader instances matched to a single record with a particular Guid. Anyone had any success with this?

Here is what I've tried with no success:

QueryFilter query = new QueryFilter("ID = " + guid);
QueryFilter query = new QueryFilter("ID = '" + guid.ToString() + "'");
QueryFilter query = new QueryFilter("ID = '{" + guid.ToString() + "}'");
QueryFilter query = new QueryFilter("ID = " + "'{" + guid.ToString() + "}'");

I've looped through the contents of my cache and it's definitely in there but I'd rather not have to loop through every time I want to get a single feature row.
0 Kudos
2 Replies
StevenSchuldt
New Contributor
I remember at some point I was running into issues with case sensitivity, although I don't recall if this was a mobile version issue, or a SQL issue, or a problem with my code.  I know I wrote a function below, however apparently I didn't end up using it.  I have filters like this in a lot of places in my code though:

string whereClause = String.Format("GlobalID = '{{{0}}}'", globalID.ToString().ToUpper());




  public static string GetGlobalIDWhereClause(string columnName, GlobalId globalID) {
   return String.Format("({0} = '{{{1}}}' OR {0} = '{{{2}}}')", columnName, globalID.ToString().ToUpper(), globalID.ToString());
  }

0 Kudos
AndrewCorcoran
New Contributor III
Thank you very much 🙂 That worked a treat!
0 Kudos