# Could not lock table error when using QueryTools.ExecuteQuery

**URL:** <https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990>\
**Category:** WinForms\
**Created:** [January 25, 2010, 10:12am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990 "2010-01-25T10:12:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 25, 2010, 10:12am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/1 "2010-01-25T10:12:26Z")

</div>

I&nbsp;apologize&nbsp;if&nbsp;this&nbsp;has&nbsp;been&nbsp;explained&nbsp;in&nbsp;another&nbsp;topic&nbsp;-&nbsp;I&nbsp;searched&nbsp;all&nbsp;morning&nbsp;and&nbsp;couldn't&nbsp;find&nbsp;anything.

I&nbsp;am&nbsp;getting&nbsp;an&nbsp;exception&nbsp;"OleDbException&nbsp;was&nbsp;unhandled&nbsp;-&nbsp;Could&nbsp;not&nbsp;lock&nbsp;table&nbsp;"IN039lkA';&nbsp;currently&nbsp;in&nbsp;use&nbsp;by&nbsp;user&nbsp;'(unknown)'&nbsp;on&nbsp;machine&nbsp;'(unknown)'.

I&nbsp;am&nbsp;trying&nbsp;to&nbsp;run&nbsp;a&nbsp;SQL&nbsp;query&nbsp;against&nbsp;a&nbsp;shapefile&nbsp;so&nbsp;I&nbsp;can&nbsp;use&nbsp;the&nbsp;LIKE&nbsp;function.&nbsp;The&nbsp;GetFeaturesByColumnValue&nbsp;is&nbsp;case&nbsp;sensitive&nbsp;which&nbsp;doesn't&nbsp;provide&nbsp;a&nbsp;user-friendly&nbsp;experience&nbsp;for&nbsp;our&nbsp;target&nbsp;users.&nbsp;We&nbsp;are&nbsp;using&nbsp;the&nbsp;2006&nbsp;USA&nbsp;maps&nbsp;by&nbsp;county&nbsp;from&nbsp;ThinkGeo,&nbsp;and&nbsp;in&nbsp;this&nbsp;example&nbsp;I&nbsp;am&nbsp;using&nbsp;the&nbsp;Elkhart&nbsp;county&nbsp;files&nbsp;-&nbsp;specifically&nbsp;IN039lkA&nbsp;which&nbsp;is&nbsp;the&nbsp;street&nbsp;shapefile.

What&nbsp;I&nbsp;am&nbsp;trying&nbsp;to&nbsp;accomplish&nbsp;is&nbsp;getting&nbsp;a&nbsp;specific&nbsp;value&nbsp;from&nbsp;a&nbsp;column&nbsp;that&nbsp;is&nbsp;like&nbsp;the&nbsp;user&nbsp;input,&nbsp;so&nbsp;I&nbsp;can&nbsp;get&nbsp;the&nbsp;shapefile's&nbsp;flavor&nbsp;of&nbsp;case&nbsp;for&nbsp;that&nbsp;value.&nbsp;From&nbsp;there&nbsp;I&nbsp;will&nbsp;be&nbsp;using&nbsp;the&nbsp;GetFeaturesByColumnValue&nbsp;to&nbsp;get&nbsp;the&nbsp;specific&nbsp;features&nbsp;I&nbsp;desire.&nbsp;I&nbsp;know&nbsp;that&nbsp;I&nbsp;can&nbsp;use&nbsp;GetAllFeatures&nbsp;and&nbsp;query&nbsp;that&nbsp;collection&nbsp;using&nbsp;.Contains&nbsp;but&nbsp;it&nbsp;is&nbsp;slow&nbsp;even&nbsp;on&nbsp;my&nbsp;2.8Ghz&nbsp;Core2Duo&nbsp;with&nbsp;4GB&nbsp;ram&nbsp;-&nbsp;specs&nbsp;far&nbsp;and&nbsp;above&nbsp;my&nbsp;users.&nbsp;This&nbsp;implementation&nbsp;will&nbsp;be&nbsp;on&nbsp;laptops&nbsp;in&nbsp;the&nbsp;field.

This&nbsp;is&nbsp;a&nbsp;proof-of-concept&nbsp;application&nbsp;outside&nbsp;of&nbsp;my&nbsp;actual&nbsp;project.&nbsp;I&nbsp;can&nbsp;provide&nbsp;source&nbsp;to&nbsp;the&nbsp;form&nbsp;if&nbsp;necessary&nbsp;(it&nbsp;currently&nbsp;has&nbsp;some&nbsp;commented&nbsp;code&nbsp;from&nbsp;a&nbsp;lot&nbsp;of&nbsp;testing).

I&nbsp;will&nbsp;try&nbsp;to&nbsp;explain&nbsp;my&nbsp;current&nbsp;test&nbsp;attempts:

  
&nbsp;&nbsp;&nbsp;&nbsp;- I&nbsp;am&nbsp;on&nbsp;form&nbsp;load&nbsp;calling&nbsp;a&nbsp;method&nbsp;to&nbsp;setup&nbsp;my&nbsp;map.&nbsp;I&nbsp;have&nbsp;2&nbsp;layers&nbsp;for&nbsp;the&nbsp;streets,&nbsp;using&nbsp;2&nbsp;different&nbsp;indexes&nbsp;so&nbsp;I&nbsp;can&nbsp;use&nbsp;different&nbsp;line&nbsp;styles&nbsp;based&nbsp;on&nbsp;road&nbsp;type.
  
&nbsp;&nbsp;&nbsp;&nbsp;- I&nbsp;have&nbsp;a&nbsp;separate&nbsp;method&nbsp;that&nbsp;is&nbsp;run,&nbsp;based&nbsp;on&nbsp;user&nbsp;input,&nbsp;to&nbsp;use&nbsp;a&nbsp;modified&nbsp;implementation&nbsp;of&nbsp;the&nbsp;Code&nbsp;Project&nbsp;for&nbsp;finding&nbsp;a&nbsp;street&nbsp;intersection&nbsp;for&nbsp;that&nbsp;purpose.
  
&nbsp;&nbsp;&nbsp;&nbsp;- The&nbsp;FENAME&nbsp;for&nbsp;streets&nbsp;in&nbsp;the&nbsp;USA&nbsp;map&nbsp;data&nbsp;is&nbsp;in&nbsp;the&nbsp;format&nbsp;of&nbsp;"County&nbsp;Road&nbsp;17"&nbsp;or&nbsp;"Suburban"&nbsp;which&nbsp;is&nbsp;causing&nbsp;the&nbsp;issue&nbsp;of&nbsp;making&nbsp;the&nbsp;user&nbsp;input&nbsp;information&nbsp;in&nbsp;the&nbsp;correct&nbsp;case.
  
&nbsp;&nbsp;&nbsp;&nbsp;- In&nbsp;the&nbsp;method&nbsp;I&nbsp;have&nbsp;tried&nbsp;to&nbsp;create&nbsp;a&nbsp;shapefile&nbsp;layer&nbsp;that&nbsp;uses&nbsp;the&nbsp;original&nbsp;'full'&nbsp;index&nbsp;so&nbsp;I&nbsp;have&nbsp;all&nbsp;road&nbsp;features&nbsp;with&nbsp;which&nbsp;to&nbsp;work.&nbsp;I&nbsp;open&nbsp;the&nbsp;file&nbsp;and&nbsp;CanExecuteQuery&nbsp;returns&nbsp;true,&nbsp;but&nbsp;I&nbsp;receive&nbsp;the&nbsp;above&nbsp;error.
  
&nbsp;&nbsp;&nbsp;&nbsp;- I&nbsp;have&nbsp;tried&nbsp;to&nbsp;make&nbsp;the&nbsp;shapefile&nbsp;as&nbsp;private&nbsp;class&nbsp;variable&nbsp;and&nbsp;while&nbsp;it&nbsp;works&nbsp;for&nbsp;the&nbsp;map&nbsp;display,&nbsp;it&nbsp;still&nbsp;gives&nbsp;me&nbsp;the&nbsp;error&nbsp;with&nbsp;the&nbsp;query...&nbsp;If&nbsp;it&nbsp;is&nbsp;only&nbsp;opened&nbsp;in&nbsp;one&nbsp;place&nbsp;how&nbsp;can&nbsp;I&nbsp;have&nbsp;that&nbsp;lock&nbsp;issue&nbsp;-&nbsp;especially&nbsp;when&nbsp;I&nbsp;am&nbsp;selecting&nbsp;data&nbsp;only?
  
&nbsp;&nbsp;&nbsp;&nbsp;- I&nbsp;am&nbsp;not&nbsp;familiar&nbsp;with&nbsp;DataTable&nbsp;so&nbsp;my&nbsp;issue&nbsp;in&nbsp;figuring&nbsp;out&nbsp;how&nbsp;to&nbsp;get&nbsp;the&nbsp;data&nbsp;back&nbsp;out&nbsp;is&nbsp;separate&nbsp;(but&nbsp;any&nbsp;help&nbsp;is&nbsp;appreciated).
  

  

I'm&nbsp;really&nbsp;at&nbsp;a&nbsp;loss.&nbsp;I&nbsp;am&nbsp;new&nbsp;to&nbsp;the&nbsp;ThinkGeo&nbsp;components&nbsp;but&nbsp;they&nbsp;are&nbsp;very&nbsp;straightforward&nbsp;to&nbsp;use.&nbsp;I&nbsp;like&nbsp;them&nbsp;quite&nbsp;a&nbsp;bit.&nbsp;Any&nbsp;help&nbsp;you&nbsp;can&nbsp;provide&nbsp;is&nbsp;great.&nbsp;It&nbsp;would&nbsp;be&nbsp;nice&nbsp;for&nbsp;an&nbsp;option&nbsp;to&nbsp;have&nbsp;a&nbsp;case-insensitive&nbsp;search&nbsp;for&nbsp;GetFeaturesByColumnValue.

Thanks.

_Edit_:&nbsp;By&nbsp;the&nbsp;way,&nbsp;the&nbsp;Query&nbsp;works&nbsp;fine&nbsp;in&nbsp;MapExplorer:&nbsp;"Select&nbsp;FENAME&nbsp;From&nbsp;IN039lkA&nbsp;Where&nbsp;FENAME&nbsp;Like('%SUBURBAN%');"

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 25, 2010, 12:09pm UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/2 "2010-01-25T12:09:30Z")

</div>

I&nbsp;have&nbsp;found&nbsp;that&nbsp;if&nbsp;I&nbsp;run&nbsp;the&nbsp;query&nbsp;in&nbsp;the&nbsp;same&nbsp;method&nbsp;that&nbsp;initially&nbsp;creates&nbsp;the&nbsp;ShapeFileFeatureLayer&nbsp;for&nbsp;the&nbsp;map,&nbsp;it&nbsp;works&nbsp;just&nbsp;fine&nbsp;without&nbsp;error&nbsp;-&nbsp;and&nbsp;that&nbsp;is&nbsp;testing&nbsp;with&nbsp;a&nbsp;layer&nbsp;for&nbsp;the&nbsp;original&nbsp;index,&nbsp;highways&nbsp;only,&nbsp;and&nbsp;secondary&nbsp;only,&nbsp;all&nbsp;active&nbsp;at&nbsp;the&nbsp;same&nbsp;time.&nbsp;There&nbsp;must&nbsp;be&nbsp;some&nbsp;way&nbsp;I&nbsp;can&nbsp;access&nbsp;the&nbsp;QueryTools&nbsp;on&nbsp;a&nbsp;layer&nbsp;in&nbsp;the&nbsp;map&nbsp;control&nbsp;from&nbsp;another&nbsp;method&nbsp;in&nbsp;the&nbsp;same&nbsp;form.

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [January 25, 2010, 2:11pm UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/3 "2010-01-25T14:11:45Z")

</div>

I&nbsp;think&nbsp;that&nbsp;it&nbsp;would&nbsp;be&nbsp;ideal&nbsp;if&nbsp;you&nbsp;could&nbsp;send&nbsp;us&nbsp;the&nbsp;your&nbsp;actual&nbsp;project&nbsp;with&nbsp;the&nbsp;code.&nbsp;That&nbsp;way&nbsp;we&nbsp;can&nbsp;go&nbsp;directly&nbsp;to&nbsp;resolving&nbsp;your&nbsp;problem&nbsp;instead&nbsp;of&nbsp;spending&nbsp;time&nbsp;setting&nbsp;up&nbsp;your&nbsp;scenario&nbsp;and&nbsp;trying&nbsp;to&nbsp;recreate&nbsp;the&nbsp;error&nbsp;on&nbsp;our&nbsp;side.&nbsp;If&nbsp;you&nbsp;don’t&nbsp;fell&nbsp;confortable&nbsp;sending&nbsp;your&nbsp;project&nbsp;in&nbsp;the&nbsp;Discussion&nbsp;Forum,&nbsp;you&nbsp;can&nbsp;use&nbsp;one&nbsp;of&nbsp;your&nbsp;Support&nbsp;tickets&nbsp;in&nbsp;the&nbsp;Customer&nbsp;Portal.&nbsp;&nbsp;  
&nbsp;&nbsp;I&nbsp;think&nbsp;that&nbsp;having&nbsp;an&nbsp;API&nbsp;for&nbsp;GetFeaturesByColumnValue&nbsp;that&nbsp;is&nbsp;case&nbsp;insensitive&nbsp;is&nbsp;a&nbsp;good&nbsp;idea.&nbsp;I&nbsp;added&nbsp;this&nbsp;idea&nbsp;to&nbsp;our&nbsp;Issue&nbsp;Tracker&nbsp;for&nbsp;the&nbsp;development&nbsp;team&nbsp;to&nbsp;consider&nbsp;it&nbsp;to&nbsp;be&nbsp;added&nbsp;to&nbsp;Map&nbsp;Suite.&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;suggestion.

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 25, 2010, 2:58pm UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/4 "2010-01-25T14:58:10Z")

</div>

Thanks!

&nbsp;This&nbsp;is&nbsp;the&nbsp;form&nbsp;I&nbsp;am&nbsp;working&nbsp;on.&nbsp;It&nbsp;should&nbsp;be&nbsp;functional&nbsp;on&nbsp;its&nbsp;own.&nbsp;It&nbsp;currently&nbsp;is&nbsp;using&nbsp;Desktop&nbsp;Edition,&nbsp;Core,&nbsp;and&nbsp;Geocode&nbsp;components.&nbsp;The&nbsp;only&nbsp;files&nbsp;it&nbsp;looks&nbsp;at&nbsp;are&nbsp;USA&nbsp;2006&nbsp;map&nbsp;data&nbsp;files&nbsp;(I&nbsp;already&nbsp;built&nbsp;the&nbsp;indexes)&nbsp;and&nbsp;2&nbsp;simple&nbsp;icons&nbsp;from&nbsp;the&nbsp;evaluation&nbsp;downloads&nbsp;(for&nbsp;convenience).&nbsp;

I&nbsp;have&nbsp;commented&nbsp;the&nbsp;code&nbsp;as&nbsp;best&nbsp;I&nbsp;could&nbsp;to&nbsp;help&nbsp;explain&nbsp;what&nbsp;I&nbsp;was&nbsp;trying/thinking.&nbsp;The&nbsp;current&nbsp;active&nbsp;code&nbsp;exhibits&nbsp;the&nbsp;problem.&nbsp;There&nbsp;is&nbsp;working&nbsp;code&nbsp;as&nbsp;well&nbsp;that&nbsp;is&nbsp;commented&nbsp;at&nbsp;this&nbsp;time&nbsp;(but&nbsp;limited&nbsp;to&nbsp;exact&nbsp;matches).

The&nbsp;page&nbsp;works&nbsp;by&nbsp;typing&nbsp;in&nbsp;data&nbsp;and&nbsp;pressing&nbsp;enter&nbsp;in&nbsp;the&nbsp;text&nbsp;field.&nbsp;If&nbsp;an&nbsp;address,&nbsp;it&nbsp;will&nbsp;geocode&nbsp;the&nbsp;data.&nbsp;If&nbsp;an&nbsp;intersection,&nbsp;notated&nbsp;by&nbsp;the&nbsp;form&nbsp;Street1&nbsp;&&nbsp;Street2,&nbsp;it&nbsp;will&nbsp;indicate&nbsp;the&nbsp;intersection&nbsp;with&nbsp;a&nbsp;red&nbsp;dot&nbsp;(or&nbsp;more&nbsp;if&nbsp;there&nbsp;are&nbsp;multiple&nbsp;matches&nbsp;in&nbsp;the&nbsp;county).&nbsp;The&nbsp;confirm&nbsp;button&nbsp;has&nbsp;no&nbsp;use&nbsp;for&nbsp;this&nbsp;page&nbsp;as&nbsp;it&nbsp;sits&nbsp;right&nbsp;now.&nbsp;Please&nbsp;let&nbsp;me&nbsp;know&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;questions.

&nbsp;

[1654-VerifyMap.zip](https://community.thinkgeo.com/uploads/default/original/2X/a/a0130257fc3e95d4d017739454021aae94aaf808.zip) (11.2 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:** [January 26, 2010, 3:54am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/5 "2010-01-26T03:54:50Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;can&nbsp;not&nbsp;test&nbsp;the&nbsp;sample&nbsp;so&nbsp;far&nbsp;because&nbsp;it&nbsp;can&nbsp;not&nbsp;compile&nbsp;that&nbsp;we&nbsp;can&nbsp;find&nbsp;the&nbsp;definition&nbsp;of&nbsp;some&nbsp;Type,&nbsp;such&nbsp;as&nbsp;Address,&nbsp;MarkerLayer&nbsp;etc.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Could&nbsp;you&nbsp;provide&nbsp;the&nbsp;entire&nbsp;sample&nbsp;code&nbsp;or&nbsp;remove&nbsp;the&nbsp;types&nbsp;that&nbsp;can&nbsp;compile?&nbsp;  
&nbsp;&nbsp;  
&nbsp;And&nbsp;we&nbsp;will&nbsp;work&nbsp;on&nbsp;it&nbsp;still,&nbsp;try&nbsp;to&nbsp;comment&nbsp;out&nbsp;some&nbsp;code&nbsp;and&nbsp;make&nbsp;it&nbsp;compile,&nbsp;if&nbsp;we&nbsp;recreate&nbsp;your&nbsp;problem&nbsp;I&nbsp;will&nbsp;let&nbsp;you&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;  
&nbsp;&nbsp;  
&nbsp;James&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 26, 2010, 7:34am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/6 "2010-01-26T07:34:47Z")

</div>

I&nbsp;am&nbsp;very&nbsp;sorry&nbsp;and&nbsp;apologize!

Attached&nbsp;is&nbsp;the&nbsp;entire&nbsp;solution.&nbsp;The&nbsp;program.cs&nbsp;is&nbsp;set&nbsp;to&nbsp;launch&nbsp;the&nbsp;VerifyMap&nbsp;form.&nbsp;There&nbsp;is&nbsp;no&nbsp;map&nbsp;data&nbsp;included&nbsp;in&nbsp;the&nbsp;sample.&nbsp;I&nbsp;just&nbsp;tested&nbsp;this&nbsp;and&nbsp;it&nbsp;worked&nbsp;fine.&nbsp;Again,&nbsp;I&nbsp;built&nbsp;the&nbsp;indexes&nbsp;separately&nbsp;from&nbsp;this&nbsp;program.&nbsp;The&nbsp;IN039Highway.idx&nbsp;is&nbsp;CFCC,&nbsp;A[1][0-9],&nbsp;IN039Secondary.idx&nbsp;is&nbsp;CFCC,&nbsp;A[2-3][0-9],&nbsp;and&nbsp;IN039LocalRoad.idx&nbsp;is&nbsp;CFCC,&nbsp;A[4-9][0-9].&nbsp;All&nbsp;others&nbsp;are&nbsp;a&nbsp;standard&nbsp;index&nbsp;file&nbsp;for&nbsp;that&nbsp;shapefile.&nbsp;I&nbsp;am&nbsp;also&nbsp;having&nbsp;an&nbsp;issue&nbsp;with&nbsp;the&nbsp;extent&nbsp;for&nbsp;the&nbsp;map.&nbsp;When&nbsp;I&nbsp;use&nbsp;the&nbsp;Lake&nbsp;County,&nbsp;IN&nbsp;information&nbsp;using&nbsp;the&nbsp;BoundingBox&nbsp;of&nbsp;the&nbsp;county&nbsp;layer&nbsp;it&nbsp;works&nbsp;fine,&nbsp;but&nbsp;the&nbsp;same&nbsp;method&nbsp;on&nbsp;the&nbsp;Elkhart&nbsp;County,&nbsp;IN&nbsp;data&nbsp;does&nbsp;not&nbsp;'zoom&nbsp;in'&nbsp;on&nbsp;the&nbsp;county&nbsp;in&nbsp;the&nbsp;same&nbsp;way.

Thank&nbsp;you&nbsp;for&nbsp;all&nbsp;your&nbsp;help.&nbsp;You&nbsp;have&nbsp;all&nbsp;be&nbsp;very&nbsp;helpful.

[1662-ThinkGeoGIS\_PoC.zip](https://community.thinkgeo.com/uploads/default/original/2X/7/78f2a704a3bf517812771a9b72fe12c92c836992.zip) (91.5 KB)

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 26, 2010, 9:16am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/7 "2010-01-26T09:16:53Z")

</div>

I&nbsp;did&nbsp;figure&nbsp;out&nbsp;the&nbsp;issue&nbsp;with&nbsp;the&nbsp;CurrentExtent.&nbsp;I&nbsp;had&nbsp;zoom&nbsp;level&nbsp;snapping&nbsp;on&nbsp;and&nbsp;that&nbsp;was&nbsp;causing&nbsp;the&nbsp;problem.&nbsp;I&nbsp;set&nbsp;it&nbsp;to&nbsp;none&nbsp;and&nbsp;it&nbsp;worked.&nbsp;I&nbsp;still&nbsp;haven’t&nbsp;figured&nbsp;out&nbsp;the&nbsp;problem&nbsp;with&nbsp;the&nbsp;QueryTools&nbsp;but&nbsp;am&nbsp;still&nbsp;looking.

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [January 26, 2010, 9:39am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/8 "2010-01-26T09:39:38Z")

</div>

I&nbsp;have&nbsp;your&nbsp;solution&nbsp;opened&nbsp;with&nbsp;the&nbsp;references&nbsp;that&nbsp;you&nbsp;need&nbsp;for&nbsp;Map&nbsp;Suite&nbsp;such&nbsp;as&nbsp;DesktopEdition,&nbsp;MapSuiteCore,&nbsp;MapSuiteGeocoder,&nbsp;NetTopologySuite.&nbsp;But,&nbsp;I&nbsp;still&nbsp;have&nbsp;a&nbsp;reference&nbsp;problem.&nbsp;I&nbsp;have&nbsp;the&nbsp;error&nbsp;“The&nbsp;type&nbsp;or&nbsp;namespace&nbsp;name&nbsp;‘MatchItem’&nbsp;could&nbsp;not&nbsp;be&nbsp;found&nbsp;(are&nbsp;you&nbsp;missing&nbsp;a&nbsp;using&nbsp;directive&nbsp;or&nbsp;an&nbsp;assembly&nbsp;reference?)”.&nbsp;What&nbsp;is&nbsp;that&nbsp;MatchItem&nbsp;object,&nbsp;what&nbsp;reference&nbsp;do&nbsp;I&nbsp;need&nbsp;for&nbsp;that&nbsp;or&nbsp;where&nbsp;is&nbsp;its&nbsp;definition?

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 26, 2010, 9:46am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/9 "2010-01-26T09:46:05Z")

</div>

That&nbsp;is&nbsp;part&nbsp;of&nbsp;Geocoder&nbsp;I&nbsp;beleive.&nbsp;When&nbsp;I&nbsp;go&nbsp;to&nbsp;definition&nbsp;it&nbsp;brings&nbsp;up&nbsp;&nbsp;namespace&nbsp;ThinkGeo.MapSuite.MapSuiteGeocoder,&nbsp;public&nbsp;class&nbsp;is&nbsp;MatchItem

&nbsp;

 ![](https://community.thinkgeo.com/uploads/default/original/2X/0/00df201590562aca974ac4e30f9f9b218ca38007.png)

&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:** [January 27, 2010, 2:40am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/10 "2010-01-27T02:40:14Z")

</div>

&nbsp;

David,  
&nbsp;  
Right&nbsp;now,&nbsp;the&nbsp;sample&nbsp;project&nbsp;can&nbsp;compile,&nbsp;but&nbsp;we&nbsp;still&nbsp;can&nbsp;not&nbsp;test&nbsp;because&nbsp;of&nbsp;lacking&nbsp;of&nbsp;data,&nbsp;we&nbsp;need&nbsp;the&nbsp;shape&nbsp;files&nbsp;that&nbsp;can&nbsp;show&nbsp;the&nbsp;exception&nbsp;be&nbsp;thrown&nbsp;when&nbsp;you&nbsp;do&nbsp;the&nbsp;spatial&nbsp;query,&nbsp;I&nbsp;have&nbsp;reviewed&nbsp;the&nbsp;code,&nbsp;I&nbsp;think&nbsp;there&nbsp;is&nbsp;no&nbsp;incorrect&nbsp;usage&nbsp;in&nbsp;it.&nbsp;So&nbsp;could&nbsp;you&nbsp;provide&nbsp;the&nbsp;data&nbsp;as&nbsp;well?  
If&nbsp;you&nbsp;don’t&nbsp;fell&nbsp;comfortable&nbsp;sending&nbsp;your&nbsp;private&nbsp;data&nbsp;in&nbsp;the&nbsp;Discussion&nbsp;Forum,&nbsp;you&nbsp;can&nbsp;send&nbsp;it&nbsp;to&nbsp;[support@thinkgeo.com](mailto:support@thinkgeo.com),&nbsp;and&nbsp;let&nbsp;him&nbsp;forward&nbsp;to&nbsp;James.  
&nbsp;  
I&nbsp;am&nbsp;sure&nbsp;if&nbsp;we&nbsp;can&nbsp;recreate&nbsp;your&nbsp;problem,&nbsp;we&nbsp;would&nbsp;give&nbsp;your&nbsp;some&nbsp;solution&nbsp;to&nbsp;solve&nbsp;it.&nbsp;  
&nbsp;  
Thanks  
James

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 27, 2010, 7:33am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/11 "2010-01-27T07:33:05Z")

</div>

James,

I&nbsp;am&nbsp;attaching&nbsp;the&nbsp;data.&nbsp;Due&nbsp;to&nbsp;size,&nbsp;I&nbsp;have&nbsp;compressed&nbsp;it&nbsp;with&nbsp;7zip&nbsp;in&nbsp;2&nbsp;files&nbsp;(max&nbsp;attach&nbsp;file&nbsp;size&nbsp;is&nbsp;500kb)&nbsp;and&nbsp;then&nbsp;placed&nbsp;in&nbsp;a&nbsp;Zip&nbsp;file&nbsp;(can't&nbsp;attach&nbsp;7z).&nbsp;All&nbsp;files&nbsp;were&nbsp;in&nbsp;the&nbsp;same&nbsp;folder.&nbsp;The&nbsp;data&nbsp;is&nbsp;from&nbsp;the&nbsp;ThinkGeo&nbsp;USA&nbsp;2006&nbsp;Map&nbsp;Data&nbsp;with&nbsp;3&nbsp;custom&nbsp;indexes&nbsp;for&nbsp;the&nbsp;IN039lkA.shp&nbsp;road&nbsp;layer.

Thanks,

David

[1670-Elkhart-Set1.zip](https://community.thinkgeo.com/uploads/default/original/2X/d/df1c97f34a508b8d3176eef1233e88a153259ae0.zip) (394 KB)  
[1671-Elkhart-Set2.zip](https://community.thinkgeo.com/uploads/default/original/2X/d/dc811b75b1c275347c15e3a6bc1ad370e8476ee7.zip) (387 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:** [January 28, 2010, 3:57am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/12 "2010-01-28T03:57:45Z")

</div>

&nbsp;

David,  
&nbsp;  
Now,&nbsp;I&nbsp;got&nbsp;the&nbsp;data&nbsp;and&nbsp;I&nbsp;can&nbsp;test,&nbsp;from&nbsp;the&nbsp;comment&nbsp;of&nbsp;your&nbsp;sample,&nbsp;I&nbsp;found&nbsp;the&nbsp;code&nbsp;that&nbsp;it&nbsp;will&nbsp;throw&nbsp;exception&nbsp;when&nbsp;you&nbsp;use&nbsp;QueryTools.  
&nbsp;  
Do&nbsp;you&nbsp;mean&nbsp;this&nbsp;code&nbsp;will&nbsp;throw&nbsp;exception?  
DataTable&nbsp;dt1&nbsp;=&nbsp;StreetLayer.QueryTools.ExecuteQuery("Select&nbsp;FENAME&nbsp;From&nbsp;IN039lkA&nbsp;Where&nbsp;FENAME&nbsp;Like('%"&nbsp;+&nbsp;street1&nbsp;+&nbsp;"%');");  
StreetLayer&nbsp;is&nbsp;using&nbsp;IN039lkA&nbsp;data.  
&nbsp;  
I&nbsp;test&nbsp;this&nbsp;method&nbsp;by&nbsp;using&nbsp;“County”&nbsp;instead&nbsp;of&nbsp;street1,&nbsp;it&nbsp;works&nbsp;and&nbsp;will&nbsp;return&nbsp;2639&nbsp;records.  
&nbsp;  
If&nbsp;your&nbsp;problem&nbsp;is&nbsp;like&nbsp;this,&nbsp;please&nbsp;let&nbsp;me&nbsp;know&nbsp;the&nbsp;value&nbsp;of&nbsp;street1&nbsp;when&nbsp;the&nbsp;exception&nbsp;thrown.  
&nbsp;  
If&nbsp;not,&nbsp;please&nbsp;explain&nbsp;your&nbsp;problem&nbsp;by&nbsp;simple&nbsp;code.  
&nbsp;  
Thanks  
&nbsp;  
James

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 28, 2010, 8:15am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/13 "2010-01-28T08:15:31Z")

</div>

James,

Yes,&nbsp;that&nbsp;is&nbsp;the&nbsp;code&nbsp;that&nbsp;throws&nbsp;the&nbsp;exception.&nbsp;I&nbsp;tried&nbsp;your&nbsp;suggestion&nbsp;with&nbsp;a&nbsp;SQL&nbsp;statement&nbsp;as&nbsp;shown&nbsp;in&nbsp;the&nbsp;second&nbsp;screenshot&nbsp;for&nbsp;this&nbsp;post.&nbsp;The&nbsp;first&nbsp;screenshot&nbsp;is&nbsp;of&nbsp;MapSuiteExplorer&nbsp;and&nbsp;shows&nbsp;that&nbsp;the&nbsp;query&nbsp;will&nbsp;return&nbsp;results.&nbsp;I&nbsp;have&nbsp;tried&nbsp;many&nbsp;ways&nbsp;of&nbsp;constructing&nbsp;the&nbsp;statement&nbsp;and&nbsp;still&nbsp;receive&nbsp;the&nbsp;exception.

If&nbsp;I&nbsp;execute&nbsp;this&nbsp;code&nbsp;in&nbsp;my&nbsp;SetupMap&nbsp;method&nbsp;it&nbsp;works&nbsp;fine&nbsp;and&nbsp;recieves&nbsp;the&nbsp;2639&nbsp;results:

` // Test after other layers of same file are open - This DOES work.             ShapeFileFeatureLayer AllRoads = new ShapeFileFeatureLayer(Path.Combine(INmapbase, @"Elkhart\IN039lkA.shp")); AllRoads.Open(); DataTable dtTest = AllRoads.QueryTools.ExecuteQuery("Select FENAME From IN039lkA Where FENAME Like('%County%');"); Console.WriteLine(dtTest.Rows.Count); AllRoads.Close();  `

I&nbsp;have&nbsp;modified&nbsp;my&nbsp;code&nbsp;to&nbsp;allow&nbsp;me&nbsp;to&nbsp;switch&nbsp;between&nbsp;a&nbsp;list&nbsp;of&nbsp;counties&nbsp;for&nbsp;my&nbsp;demonstrations&nbsp;to&nbsp;management.&nbsp;I&nbsp;added&nbsp;a&nbsp;snippet&nbsp;of&nbsp;code&nbsp;to&nbsp;find&nbsp;the&nbsp;number&nbsp;of&nbsp;streets&nbsp;in&nbsp;the&nbsp;road&nbsp;layer&nbsp;to&nbsp;adjust&nbsp;the&nbsp;zoom&nbsp;level&nbsp;that&nbsp;it&nbsp;displays&nbsp;what&nbsp;style.&nbsp;Later&nbsp;in&nbsp;the&nbsp;same&nbsp;method&nbsp;I&nbsp;am&nbsp;running&nbsp;a&nbsp;query&nbsp;against&nbsp;the&nbsp;same&nbsp;layer&nbsp;to&nbsp;get&nbsp;a&nbsp;distinct&nbsp;list&nbsp;of&nbsp;Zip&nbsp;codes.&nbsp;When&nbsp;I&nbsp;first&nbsp;choose&nbsp;a&nbsp;county&nbsp;to&nbsp;display&nbsp;map&nbsp;etc,&nbsp;it&nbsp;works&nbsp;fine.&nbsp;If&nbsp;I&nbsp;attempt&nbsp;to&nbsp;go&nbsp;back&nbsp;to&nbsp;a&nbsp;previously&nbsp;viewed&nbsp;map&nbsp;I&nbsp;recieve&nbsp;that&nbsp;same&nbsp;lock&nbsp;error&nbsp;on&nbsp;the&nbsp;second&nbsp;query&nbsp;in&nbsp;the&nbsp;SetupMap&nbsp;method.&nbsp;I&nbsp;am&nbsp;currently&nbsp;opening&nbsp;and&nbsp;closing&nbsp;the&nbsp;layer&nbsp;for&nbsp;the&nbsp;first&nbsp;and&nbsp;then&nbsp;second&nbsp;query.&nbsp;I&nbsp;attempted&nbsp;to&nbsp;leave&nbsp;the&nbsp;layer&nbsp;open&nbsp;for&nbsp;both&nbsp;and&nbsp;still&nbsp;received&nbsp;the&nbsp;error.

I&nbsp;will&nbsp;attach&nbsp;everything&nbsp;I&nbsp;can&nbsp;think&nbsp;of&nbsp;to&nbsp;this&nbsp;message.&nbsp;The&nbsp;Elkhart&nbsp;county&nbsp;(IN039xxx)&nbsp;data&nbsp;will&nbsp;remain&nbsp;the&nbsp;same,&nbsp;but&nbsp;I&nbsp;will&nbsp;include&nbsp;the&nbsp;data&nbsp;for&nbsp;Adams&nbsp;and&nbsp;Allen&nbsp;as&nbsp;well.&nbsp;If&nbsp;you&nbsp;want&nbsp;the&nbsp;other&nbsp;county&nbsp;data&nbsp;from&nbsp;the&nbsp;sample&nbsp;I&nbsp;can&nbsp;provide&nbsp;that&nbsp;too,&nbsp;but&nbsp;you&nbsp;can&nbsp;test&nbsp;with&nbsp;just&nbsp;3&nbsp;counties.&nbsp;

It&nbsp;looks&nbsp;like&nbsp;I&nbsp;am&nbsp;limited&nbsp;to&nbsp;3&nbsp;files&nbsp;per&nbsp;post&nbsp;or&nbsp;some&nbsp;size&nbsp;limit,&nbsp;so&nbsp;I&nbsp;will&nbsp;make&nbsp;replies&nbsp;to&nbsp;add&nbsp;the&nbsp;remaining&nbsp;files.

[1679-ThinkGeoGIS\_PoC-New.zip](https://community.thinkgeo.com/uploads/default/original/2X/c/ce5d744f6b0402f908b8e2e938757531e91137db.zip) (177 KB)  
[1682-Adams-1.zip](https://community.thinkgeo.com/uploads/default/original/2X/f/f33d84a526c067f3b11e9d868d16602d9eabb7aa.zip) (369 KB)  
[1683-Adams-2.zip](https://community.thinkgeo.com/uploads/default/original/2X/4/4158b93574b32b11472c21ecca0a18cbdcabc129.zip) (242 KB)

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 28, 2010, 8:18am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/14 "2010-01-28T08:18:13Z")

</div>

I&nbsp;just&nbsp;noticed&nbsp;the&nbsp;source&nbsp;code&nbsp;didn't&nbsp;format&nbsp;at&nbsp;all&nbsp;correctly&nbsp;in&nbsp;the&nbsp;last&nbsp;post.&nbsp;Sorry.

Here&nbsp;is&nbsp;the&nbsp;Allen&nbsp;county&nbsp;data.

Please&nbsp;let&nbsp;me&nbsp;know&nbsp;if&nbsp;you&nbsp;need&nbsp;anything&nbsp;else.&nbsp;I&nbsp;have&nbsp;a&nbsp;LogMeIn&nbsp;Rescuse&nbsp;account,&nbsp;so&nbsp;if&nbsp;a&nbsp;screen&nbsp;sharing&nbsp;session&nbsp;would&nbsp;be&nbsp;helpful,&nbsp;I&nbsp;can&nbsp;arrange&nbsp;that&nbsp;and&nbsp;share&nbsp;my&nbsp;screen&nbsp;with&nbsp;you.

Thanks,

David

[1684-Allen-1.zip](https://community.thinkgeo.com/uploads/default/original/2X/4/4909b29603fe3b5126f8ba4ebb677c3c476a9c78.zip) (241 KB)  
[1685-Allen-2.zip](https://community.thinkgeo.com/uploads/default/original/2X/1/1f3acb0502389c1a35ee59b2a5e3253f70d81cba.zip) (371 KB)  
[1686-Allen-3.zip](https://community.thinkgeo.com/uploads/default/original/2X/1/1b66d3c2edc342a9f127daaf06dc0fec70977d1b.zip) (489 KB)

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 28, 2010, 8:21am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/15 "2010-01-28T08:21:04Z")

</div>

Forgot&nbsp;to&nbsp;add&nbsp;screenshots.

 ![](https://community.thinkgeo.com/uploads/default/original/2X/5/518650ece29283c38c89584be40a24bc397bcf58.png)

&nbsp;

 ![](https://community.thinkgeo.com/uploads/default/original/2X/1/1d0b0924bdb1b960157d86c79df865837939cfc5.png)

---

<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:** [January 29, 2010, 12:26am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/16 "2010-01-29T00:26:13Z")

</div>

David,

Thanks&nbsp;for&nbsp;your&nbsp;patience.

I&nbsp;still&nbsp;can&nbsp;not&nbsp;recreate&nbsp;your&nbsp;problem,&nbsp;maybe&nbsp;I&nbsp;misunderstand&nbsp;your&nbsp;meaning.

So&nbsp;I&nbsp;have&nbsp;built&nbsp;a&nbsp;simple&nbsp;sample,&nbsp;could&nbsp;you&nbsp;modify&nbsp;the&nbsp;code&nbsp;and&nbsp;make&nbsp;it&nbsp;can&nbsp;recreate&nbsp;your&nbsp;problem?

I&nbsp;think&nbsp;this&nbsp;is&nbsp;more&nbsp;effiecient&nbsp;way&nbsp;to&nbsp;solve&nbsp;this&nbsp;problem.

Thanks

James

[1690-QueryToolsTest.zip](https://community.thinkgeo.com/uploads/default/original/2X/4/4790d5025d77bbc2d47b3f34d253ff3e2883ccfd.zip) (10.1 KB)

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [January 29, 2010, 7:51am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/17 "2010-01-29T07:51:09Z")

</div>

I&nbsp;was&nbsp;able&nbsp;to&nbsp;reproduce&nbsp;the&nbsp;issue&nbsp;with&nbsp;a&nbsp;few&nbsp;lines&nbsp;of&nbsp;code.&nbsp;The&nbsp;problem&nbsp;starts&nbsp;when&nbsp;I&nbsp;call&nbsp;Map.Refresh.&nbsp;When&nbsp;you&nbsp;look&nbsp;at&nbsp;the&nbsp;code&nbsp;you&nbsp;will&nbsp;see&nbsp;my&nbsp;comments.&nbsp;I&nbsp;can&nbsp;do&nbsp;everything&nbsp;with&nbsp;the&nbsp;shapefile&nbsp;in&nbsp;my&nbsp;Form.Load&nbsp;event&nbsp;to&nbsp;setup&nbsp;the&nbsp;map&nbsp;and&nbsp;the&nbsp;button&nbsp;click&nbsp;event&nbsp;works&nbsp;SO&nbsp;LONG&nbsp;AS&nbsp;I&nbsp;do&nbsp;not&nbsp;call&nbsp;Map.Refresh.&nbsp;That&nbsp;seems&nbsp;to&nbsp;be&nbsp;the&nbsp;cause&nbsp;of&nbsp;the&nbsp;problem.

[1691-QueryToolsTest\_Showing\_Error.zip](https://community.thinkgeo.com/uploads/default/original/2X/f/f0cc483c0cc8ae07d395d15840f445966f92aad5.zip) (29.2 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:** [January 31, 2010, 8:34pm UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/18 "2010-01-31T20:34:50Z")

</div>

&nbsp;

David,  
&nbsp;  
I&nbsp;still&nbsp;can&nbsp;not&nbsp;recreate&nbsp;your&nbsp;problem&nbsp;even&nbsp;I&nbsp;execute&nbsp;a&nbsp;map.Refresh().&nbsp;My&nbsp;sample&nbsp;only&nbsp;uses&nbsp;MapSuiteCore,&nbsp;but&nbsp;I&nbsp;noticed&nbsp;that&nbsp;you&nbsp;add&nbsp;DesktopEdition&nbsp;as&nbsp;reference,&nbsp;so&nbsp;I&nbsp;guess&nbsp;if&nbsp;only&nbsp;use&nbsp;QueryTools&nbsp;in&nbsp;MapSuiteCore&nbsp;it&nbsp;won’t&nbsp;cause&nbsp;the&nbsp;error.  
&nbsp;  
In&nbsp;order&nbsp;to&nbsp;figure&nbsp;out&nbsp;what&nbsp;happened,&nbsp;you&nbsp;need&nbsp;to&nbsp;give&nbsp;us&nbsp;more&nbsp;information.&nbsp;I&nbsp;guess&nbsp;there&nbsp;is&nbsp;something&nbsp;different&nbsp;for&nbsp;our&nbsp;environment&nbsp;so&nbsp;that&nbsp;I&nbsp;can&nbsp;not&nbsp;recreate&nbsp;but&nbsp;you&nbsp;can.  
If&nbsp;you&nbsp;can&nbsp;provide&nbsp;the&nbsp;following&nbsp;information&nbsp;I&nbsp;think&nbsp;it&nbsp;will&nbsp;be&nbsp;helpful.  
&nbsp;  
_The&nbsp;version&nbsp;of&nbsp;DesktopEdition?&nbsp;You&nbsp;can&nbsp;get&nbsp;the&nbsp;version&nbsp;by&nbsp;calling&nbsp;the&nbsp;static&nbsp;API&nbsp;WinformsMap.GetVersion()._  
_What’s&nbsp;kind&nbsp;of&nbsp;OS?&nbsp;For&nbsp;example,&nbsp;WindowsXP&nbsp;SP2&nbsp;64x&nbsp;French.&nbsp;_  
_Please&nbsp;attach&nbsp;your&nbsp;StackTrace&nbsp;for&nbsp;the&nbsp;exception._  
&nbsp;  
&nbsp;  
Thanks  
James

---

<div class="post-metadata">

**Author:** ![David1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/73ab20/32.png) [@David1](https://community.thinkgeo.com/u/David1)\
**Post date:** [February 1, 2010, 7:06am UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/19 "2010-02-01T07:06:13Z")

</div>

James,

Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;continued&nbsp;help!&nbsp;The&nbsp;static&nbsp;returns:&nbsp;MapSuiteCore:3.1.299;DesktopEdition:3.1.299.&nbsp;Attached&nbsp;is&nbsp;the&nbsp;stack&nbsp;trace&nbsp;I&nbsp;am&nbsp;receiving&nbsp;when&nbsp;using&nbsp;the&nbsp;version&nbsp;of&nbsp;the&nbsp;QueryToolsTest&nbsp;I&nbsp;posted.

I&nbsp;have&nbsp;found&nbsp;a&nbsp;workaround&nbsp;for&nbsp;this,&nbsp;but&nbsp;I&nbsp;am&nbsp;really&nbsp;concerned&nbsp;about&nbsp;this&nbsp;issue&nbsp;because&nbsp;I&nbsp;am&nbsp;certain&nbsp;I&nbsp;will&nbsp;need&nbsp;this&nbsp;for&nbsp;our&nbsp;reporting&nbsp;elements.

&nbsp;

` RoadLayer.Open(); Collection<Feature> streetnames = RoadLayer.FeatureSource.GetAllFeatures(new string[] { "FENAME" }); string Street1Name = streetnames.FirstOrDefault(s => s.ColumnValues["FENAME"].ToString().ToUpper() == ConvertStreet(Street1).ToUpper()).ColumnValues["FENAME"].ToString(); string Street2Name = streetnames.FirstOrDefault(s => s.ColumnValues["FENAME"].ToString().ToUpper() == ConvertStreet(Street2).ToUpper()).ColumnValues["FENAME"].ToString(); Collection<Feature> street1features = RoadLayer.FeatureSource.GetFeaturesByColumnValue("FENAME", Street1Name); Collection<Feature> street2features = RoadLayer.FeatureSource.GetFeaturesByColumnValue("FENAME", Street2Name); RoadLayer.Close();`

Best&nbsp;regards,

David

[1700-ThinkGeo\_QueryToolsTest\_stacktrace.txt](https://community.thinkgeo.com/uploads/default/original/2X/8/8d27ce1c9db6b5b2de33d2b02629912bdf53b390.txt) (9.16 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:** [February 1, 2010, 9:39pm UTC](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990/20 "2010-02-01T21:39:30Z")

</div>

&nbsp;

David,  
&nbsp;  
The&nbsp;information&nbsp;you&nbsp;provided&nbsp;is&nbsp;very&nbsp;helpful,&nbsp;I&nbsp;test&nbsp;the&nbsp;same&nbsp;version&nbsp;of&nbsp;DLL&nbsp;with&nbsp;yours,&nbsp;still&nbsp;can&nbsp;not&nbsp;recreate&nbsp;your&nbsp;problem.  
&nbsp;  
Could&nbsp;you&nbsp;provide&nbsp;what&nbsp;your&nbsp;operating&nbsp;system&nbsp;is?&nbsp;I&nbsp;have&nbsp;tested&nbsp;Windows&nbsp;XP&nbsp;32bit&nbsp;EN&nbsp;and&nbsp;Windows&nbsp;7&nbsp;32bit&nbsp;EN,&nbsp;they&nbsp;are&nbsp;working.&nbsp;The&nbsp;Windows&nbsp;XP&nbsp;64bit&nbsp;EN&nbsp;will&nbsp;throw&nbsp;another&nbsp;exception&nbsp;“System.InvalidOperationException:&nbsp;The&nbsp;'Microsoft.Jet.OLEDB.4.0'&nbsp;provider&nbsp;is&nbsp;not&nbsp;registered&nbsp;on&nbsp;the&nbsp;local&nbsp;machine.”  
&nbsp;  
So&nbsp;if&nbsp;you&nbsp;can&nbsp;provide&nbsp;more&nbsp;information&nbsp;to&nbsp;use,&nbsp;I&nbsp;think&nbsp;it&nbsp;will&nbsp;help&nbsp;us&nbsp;to&nbsp;recreate&nbsp;your&nbsp;problem.&nbsp;If&nbsp;we&nbsp;can&nbsp;recreate&nbsp;your&nbsp;problem&nbsp;in&nbsp;our&nbsp;side,&nbsp;the&nbsp;problem&nbsp;would&nbsp;be&nbsp;fixed&nbsp;easily.  
&nbsp;  
Any&nbsp;special&nbsp;things&nbsp;you&nbsp;could&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;  
I&nbsp;will&nbsp;do&nbsp;more&nbsp;research&nbsp;on&nbsp;strack&nbsp;trace&nbsp;and&nbsp;try&nbsp;to&nbsp;figure&nbsp;out&nbsp;the&nbsp;problem.  
&nbsp;  
Thanks  
&nbsp;  
James

[Next page](https://community.thinkgeo.com/t/could-not-lock-table-error-when-using-querytools-executequery/990.md?page=2)
