# ExecuteScalar issue

**URL:** <https://community.thinkgeo.com/t/executescalar-issue/653>\
**Category:** WinForms\
**Created:** [September 1, 2009, 1:14pm UTC](https://community.thinkgeo.com/t/executescalar-issue/653 "2009-09-01T13:14:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![madduri\_raghunath](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/8dc957/32.png) [@madduri\_raghunath](https://community.thinkgeo.com/u/madduri_raghunath)\
**Post date:** [September 1, 2009, 1:14pm UTC](https://community.thinkgeo.com/t/executescalar-issue/653/1 "2009-09-01T13:14:10Z")

</div>

&nbsp;

Hi,

I&nbsp;have&nbsp;a&nbsp;Shapefile&nbsp;layer&nbsp;that&nbsp;I&nbsp;want&nbsp;to&nbsp;query&nbsp;a&nbsp;value&nbsp;from.

Dim

&nbsp;CntyLayer&nbsp;As&nbsp;New&nbsp;ShapeFileFeatureLayer(MAPLayersPath&nbsp;+&nbsp;"\"&nbsp;+&nbsp;COUNTYBORDER\_LayerFile)

Thanks&nbsp;,&nbsp;Madduri

&nbsp;

CntyLayer.Open()

Dim&nbsp;layerName&nbsp;=&nbsp;System.IO.Path.GetFileNameWithoutExtension(COUNTYBORDER\_LayerFile)Dim&nbsp;CntyName&nbsp;=&nbsp;CntyLayer.QueryTools.ExecuteScalar("SELECT&nbsp;"&nbsp;&&nbsp;CountyName&nbsp;&&nbsp;"&nbsp;FROM&nbsp;"&nbsp;&&nbsp;layerName&nbsp;&&nbsp;"&nbsp;WHERE&nbsp;"&nbsp;&&nbsp;CountyCode&nbsp;&&nbsp;"="&nbsp;&&nbsp;RoadwayCounty)

CntyLayer.Close()

I&nbsp;keep&nbsp;getting&nbsp;the&nbsp;following&nbsp;error:

The&nbsp;Microsoft&nbsp;Jet&nbsp;database&nbsp;engine&nbsp;could&nbsp;not&nbsp;find&nbsp;the&nbsp;object&nbsp;'County\_Boundary'.&nbsp;&nbsp;Make&nbsp;sure&nbsp;the&nbsp;object&nbsp;exists&nbsp;and&nbsp;that&nbsp;you&nbsp;spell&nbsp;its&nbsp;name&nbsp;and&nbsp;the&nbsp;path&nbsp;name&nbsp;correctly.

The&nbsp;sql&nbsp;query&nbsp;evaluates&nbsp;to:

"SELECT&nbsp;CNTY\_NAME&nbsp;FROM&nbsp;County\_Boundary&nbsp;WHERE&nbsp;CNTY\_CODE=1"

I&nbsp;have&nbsp;checked&nbsp;that&nbsp;the&nbsp;dbf&nbsp;file&nbsp;and&nbsp;shp&nbsp;files&nbsp;exist&nbsp;in&nbsp;the&nbsp;path.&nbsp;Also&nbsp;the&nbsp;layer&nbsp;appears&nbsp;correctly&nbsp;on&nbsp;the&nbsp;map.&nbsp;What&nbsp;am&nbsp;I&nbsp;doing&nbsp;wrong&nbsp;here?

---

<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:** [September 2, 2009, 3:02am UTC](https://community.thinkgeo.com/t/executescalar-issue/653/2 "2009-09-02T03:02:31Z")

</div>

Madduri,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;question!&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;tried&nbsp;the&nbsp;code&nbsp;with&nbsp;a&nbsp;different&nbsp;data,&nbsp;and&nbsp;it&nbsp;works&nbsp;fine.&nbsp;So&nbsp;I&nbsp;doubt&nbsp;the&nbsp;data&nbsp;you&nbsp;are&nbsp;using&nbsp;is&nbsp;the&nbsp;reason&nbsp;for&nbsp;this&nbsp;problem,&nbsp;could&nbsp;you&nbsp;send&nbsp;me&nbsp;your&nbsp;data&nbsp;for&nbsp;this?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![madduri\_raghunath](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/8dc957/32.png) [@madduri\_raghunath](https://community.thinkgeo.com/u/madduri_raghunath)\
**Post date:** [September 2, 2009, 7:08am UTC](https://community.thinkgeo.com/t/executescalar-issue/653/3 "2009-09-02T07:08:04Z")

</div>

Hi,

Attached&nbsp;zip&nbsp;file&nbsp;contians&nbsp;the&nbsp;data.

Thanks&nbsp;for&nbsp;your&nbsp;help.

-Madduri

[1136-County\_Boundary.zip](https://community.thinkgeo.com/uploads/default/original/2X/4/429acc05885f4027e3b22bc2c06237fe58e12f61.zip) (91.6 KB)

---

<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:** [September 2, 2009, 8:36pm UTC](https://community.thinkgeo.com/t/executescalar-issue/653/4 "2009-09-02T20:36:14Z")

</div>

&nbsp;

Madduri,  
&nbsp;  
You&nbsp;missed&nbsp;the&nbsp;.shx&nbsp;file&nbsp;:).&nbsp;Could&nbsp;you&nbsp;upload&nbsp;the&nbsp;corresponding&nbsp;.shx&nbsp;file?  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<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:** [September 2, 2009, 10:00pm UTC](https://community.thinkgeo.com/t/executescalar-issue/653/5 "2009-09-02T22:00:24Z")

</div>

Madduri,&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;found&nbsp;that&nbsp;root&nbsp;reason&nbsp;for&nbsp;this&nbsp;problem,&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;file&nbsp;name&nbsp;should&nbsp;be&nbsp;less&nbsp;than&nbsp;8&nbsp;characters.&nbsp;It&nbsp;seems&nbsp;that&nbsp;OLEDB&nbsp;does&nbsp;not&nbsp;support&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;can&nbsp;rename&nbsp;it&nbsp;to&nbsp;Boundary.shp&nbsp;or&nbsp;something.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![madduri\_raghunath](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/8dc957/32.png) [@madduri\_raghunath](https://community.thinkgeo.com/u/madduri_raghunath)\
**Post date:** [September 3, 2009, 4:29pm UTC](https://community.thinkgeo.com/t/executescalar-issue/653/6 "2009-09-03T16:29:12Z")

</div>

Thank&nbsp;you.&nbsp;Really&nbsp;appreciate&nbsp;you&nbsp;looking&nbsp;into&nbsp;this.

I&nbsp;have&nbsp;implemented&nbsp;a&nbsp;workaround&nbsp;for&nbsp;this&nbsp;issue.&nbsp;I&nbsp;was&nbsp;able&nbsp;to&nbsp;use&nbsp;the&nbsp;find&nbsp;features&nbsp;containing&nbsp;method&nbsp;to&nbsp;get&nbsp;the&nbsp;value&nbsp;I&nbsp;need.&nbsp;It&nbsp;worked&nbsp;out&nbsp;in&nbsp;the&nbsp;current&nbsp;situation,&nbsp;but&nbsp;I&nbsp;will&nbsp;check&nbsp;file&nbsp;name&nbsp;length&nbsp;if&nbsp;I&nbsp;have&nbsp;to&nbsp;query&nbsp;for&nbsp;a&nbsp;value&nbsp;in&nbsp;the&nbsp;future.

Regards

madduri

---

<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:** [September 4, 2009, 12:11am UTC](https://community.thinkgeo.com/t/executescalar-issue/653/7 "2009-09-04T00:11:03Z")

</div>

Madduri,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;letting&nbsp;us&nbsp;know&nbsp;your&nbsp;status!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;
