Hi guys,
We often use the WhereClause property of MsSql2008FeatureLayer. Recently we noticed strange behavior with this feature. Here is an example:
Let's say we open a layer called County and use a where clause like this:
"WHERE (CountyID=5 OR CountyID=6 OR CountyID=7)"
Later we want to use GetFeaturesByIDs to select some of the features using the following code:
If I examine the Features collection I find it contains two, one with FeatureID = 1 and one with FeatureID = 2. But neither of those features are contained in the layer when the WhereClause is applied.
Dim oFeatureIDs As New Collection(Of String)(New String() {"1", "2", "3"})
Dim oFeatures As Collection(Of Feature) = moSQLLayer.QueryTools.GetFeaturesByIds(oFeatureIDs, ReturningColumnsType.AllColumns)
The Sql that is generated when we use GetFeaturesByIDs looks like this:
I would not have expected anything to be returned. I'm not sure how this is supposed to work, we may just be doing it wrong. Can you help me with this?
SELECT [DMKey],[StateID],[CountyID],[StateName],[StateAbbr],
[StateFips],[CountyName],[CountyFIPS],[SurveySystemID],[EditingSRID],
[shape].STAsBinary() as [shape] FROM County WHERE CountyID='1' OR
CountyID='2' OR CountyID='3' AND (COUNTYID=5 OR COUNTYID=6 OR
COUNTYID=7);
Thanks!
Steve