# Looking for API 2.0 equivalent: DataQuery

**URL:** <https://community.thinkgeo.com/t/looking-for-api-2-0-equivalent-dataquery/487>\
**Category:** WinForms\
**Created:** [June 21, 2009, 11:34am UTC](https://community.thinkgeo.com/t/looking-for-api-2-0-equivalent-dataquery/487 "2009-06-21T11:34:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/p/b2d939/32.png) [@Patrick](https://community.thinkgeo.com/u/Patrick)\
**Post date:** [June 21, 2009, 11:34am UTC](https://community.thinkgeo.com/t/looking-for-api-2-0-equivalent-dataquery/487/1 "2009-06-21T11:34:28Z")

</div>

Hello,

Still&nbsp;porting&nbsp;our&nbsp;application&nbsp;from&nbsp;2.0&nbsp;=\>&nbsp;3.0,&nbsp;we&nbsp;cannot&nbsp;found&nbsp;any&nbsp;equivalent&nbsp;for&nbsp;this&nbsp;line:

DataTable&nbsp;ret&nbsp;=&nbsp;Layer.DataQuery(feature.RecordNumber,&nbsp;false);

Starting&nbsp;from&nbsp;a&nbsp;feature,&nbsp;we&nbsp;need&nbsp;to&nbsp;get&nbsp;a&nbsp;"DataTable"&nbsp;that&nbsp;contains&nbsp;the&nbsp;data&nbsp;columns.

Of&nbsp;course,&nbsp;we&nbsp;could&nbsp;find&nbsp;lot&nbsp;of&nbsp;api&nbsp;that&nbsp;retreive&nbsp;the&nbsp;data,&nbsp;but&nbsp;not&nbsp;with&nbsp;the&nbsp;good&nbsp;"datatable"&nbsp;type.

Any&nbsp;ideas&nbsp;?

Patrick.

&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:** [June 21, 2009, 9:49pm UTC](https://community.thinkgeo.com/t/looking-for-api-2-0-equivalent-dataquery/487/2 "2009-06-21T21:49:09Z")

</div>

Patrick,&nbsp;

In&nbsp;our&nbsp;current&nbsp;3.x&nbsp;version&nbsp;APIs,&nbsp;we&nbsp;will&nbsp;only&nbsp;return&nbsp;back&nbsp;Datatable&nbsp;for&nbsp;SQL&nbsp;statement&nbsp;like&nbsp;this:  
`worldLayer.Open(); DataTable dataTable = worldLayer.QueryTools .ExecuteQuery(tbxSQL.Text);worldLayer.Close();`

For&nbsp;other&nbsp;APIs,&nbsp;we&nbsp;will&nbsp;return&nbsp;collection&nbsp;of&nbsp;Features&nbsp;from&nbsp;which&nbsp;we&nbsp;will&nbsp;have&nbsp;more&nbsp;controls&nbsp;and&nbsp;flexibility.&nbsp;Following&nbsp;is&nbsp;the&nbsp;sample&nbsp;code&nbsp;you&nbsp;can&nbsp;create&nbsp;a&nbsp;DataTable&nbsp;based&nbsp;on&nbsp;the&nbsp;features&nbsp;returned&nbsp;back:

`private static DataTable GetDataTable(Collection<Feature> features){  DataTable dataTable = new DataTable("FeatureDataTable");  if (features.Count > 0)  {     foreach (string columnName in features[0].ColumnValues.Keys)     {        if (!dataTable.Columns.Contains(columnName))        {           dataTable.Columns.Add(columnName);        }     }  }  foreach (Feature feature in features)  {     dataTable.Rows.Add(feature.ColumnValues.Values);  }  return dataTable;}`

Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;let&nbsp;me&nbsp;know.

Yale
