# Get Feature or FeatureId from DataRow

**URL:** <https://community.thinkgeo.com/t/get-feature-or-featureid-from-datarow/3191>\
**Category:** WPF\
**Created:** [April 3, 2012, 7:45am UTC](https://community.thinkgeo.com/t/get-feature-or-featureid-from-datarow/3191 "2012-04-03T07:45:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/e56c9b/32.png) [@Dennis](https://community.thinkgeo.com/u/Dennis)\
**Post date:** [April 3, 2012, 7:45am UTC](https://community.thinkgeo.com/t/get-feature-or-featureid-from-datarow/3191/1 "2012-04-03T07:45:17Z")

</div>

Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;either&nbsp;get&nbsp;a&nbsp;ThinkGeo.MapSuite.Core.Feature&nbsp;or&nbsp;its&nbsp;Id&nbsp;from&nbsp;a&nbsp;System.Data.DataRow&nbsp;that&nbsp;was&nbsp;returned&nbsp;via&nbsp;an&nbsp;ExecuteQuery?

The&nbsp;dbf&nbsp;does&nbsp;not&nbsp;have&nbsp;a&nbsp;FeatureId&nbsp;column.

Below&nbsp;is&nbsp;a&nbsp;code&nbsp;snippet&nbsp;that&nbsp;shows&nbsp;the&nbsp;ExecuteQuery.

Thanks,

Dennis

ShapeFileFeatureLayer&nbsp;TheStreetsFeatures;

TheStreetsFeatures.Open();

System.Data.DataTable&nbsp;dtFeatures&nbsp;=&nbsp;TheStreetsFeatures.FeatureSource.ExecuteQuery("SELECT&nbsp;\*&nbsp;FROM&nbsp;layer.dbf&nbsp;ORDER&nbsp;BY&nbsp;MyColumn");

foreach&nbsp;(System.Data.DataRow&nbsp;TheFeatureRow&nbsp;in&nbsp;dtFeature.Rows)

{

at&nbsp;this&nbsp;point&nbsp;how&nbsp;to&nbsp;get&nbsp;the&nbsp;Feature&nbsp;or&nbsp;its&nbsp;Id?

}

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 27, 2012, 4:42am UTC](https://community.thinkgeo.com/t/get-feature-or-featureid-from-datarow/3191/2 "2012-04-27T04:42:05Z")

</div>

Dennis,&nbsp;  
&nbsp;&nbsp;  
&nbsp;ExecuteQuery&nbsp;only&nbsp;return&nbsp;the&nbsp;information&nbsp;in&nbsp;Dbf&nbsp;that&nbsp;there&nbsp;is&nbsp;no&nbsp;relationship&nbsp;with&nbsp;feature,&nbsp;but&nbsp;if&nbsp;you&nbsp;have&nbsp;a&nbsp;column&nbsp;which&nbsp;has&nbsp;unique&nbsp;record&nbsp;that&nbsp;you&nbsp;can&nbsp;use&nbsp;it&nbsp;to&nbsp;get&nbsp;feature&nbsp;id,&nbsp;For&nbsp;example,&nbsp;this&nbsp;column&nbsp;name&nbsp;is&nbsp;“recordId”,&nbsp;first&nbsp;you&nbsp;can&nbsp;get&nbsp;all&nbsp;features&nbsp;by&nbsp;using&nbsp;FeatureSource.GetAllFeatures(new&nbsp;string[]{“recordId”}),&nbsp;and&nbsp;then&nbsp;for&nbsp;each&nbsp;features&nbsp;and&nbsp;compare&nbsp;which&nbsp;feature’s&nbsp;recorded&nbsp;equals&nbsp;the&nbsp;one&nbsp;from&nbsp;data&nbsp;table.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;James&nbsp;
