dmonks

SQL Statement Error in setting FeatureLayer Outfields

Discussion created by dmonks on Feb 22, 2012
Latest reply on Feb 28, 2012 by kuiperfoliage
We are trying to set specific outfields in a feature layer and it fails for any values in Outfields other than "*".
We believe it is a bug in the runtime, perhaps adding an extra comma after the outfields. Below is the code and the corresponding error.

 LocalFeatureService.GetServiceAsync(Settings.Default.MapPackage, 1000000,
            (localFeatureService) =>
            {
                _url = localFeatureService.UrlFeatureService;
                    _jointUseFeatureLayer = new FeatureLayer()
                    {
                        Url = localFeatureService.UrlFeatureService + Settings.Default.JointUseLayerId,
                        Where = "STRUCTUREOBJECTID = " + poleItem.ObjectId.ToString(),
                        Mode = ESRI.ArcGIS.Client.FeatureLayer.QueryMode.Snapshot,
                        //OutFields = new OutFields() { "*" },
                        OutFields = new OutFields() { "OBJECTID","STRUCTUREOBJECTID","CHARGEABLE"   },
                        AutoSave = true,
                    };
                    _jointUseFeatureLayer.UpdateCompleted += JointUse_UpdateCompleted;
                    _jointUseFeatureLayer.UpdateFailed += new EventHandler<TaskFailedEventArgs>(_jointUseFeatureLayer_UpdateFailed);

                    _myMap.Layers.Add(_jointUseFeatureLayer);
                
            });


An invalid SQL statement was used. [SELECT OBJECTID,STRUCTUREOBJECTID,CHARGEABLE, FROM JOINTUSEATTACHMENT WHERE STRUCTUREOBJECTID = 18873]

Outcomes