I apologize if this has been explained in another topic - I searched all morning and couldn't find anything.
I am getting an exception "OleDbException was unhandled - Could not lock table "IN039lkA'; currently in use by user '(unknown)' on machine '(unknown)'.
I am trying to run a SQL query against a shapefile so I can use the LIKE function. The GetFeaturesByColumnValue is case sensitive which doesn't provide a user-friendly experience for our target users. We are using the 2006 USA maps by county from ThinkGeo, and in this example I am using the Elkhart county files - specifically IN039lkA which is the street shapefile.
What I am trying to accomplish is getting a specific value from a column that is like the user input, so I can get the shapefile's flavor of case for that value. From there I will be using the GetFeaturesByColumnValue to get the specific features I desire. I know that I can use GetAllFeatures and query that collection using .Contains but it is slow even on my 2.8Ghz Core2Duo with 4GB ram - specs far and above my users. This implementation will be on laptops in the field.
This is a proof-of-concept application outside of my actual project. I can provide source to the form if necessary (it currently has some commented code from a lot of testing).
I will try to explain my current test attempts:
- I am on form load calling a method to setup my map. I have 2 layers for the streets, using 2 different indexes so I can use different line styles based on road type.
- I have a separate method that is run, based on user input, to use a modified implementation of the Code Project for finding a street intersection for that purpose.
- The FENAME for streets in the USA map data is in the format of "County Road 17" or "Suburban" which is causing the issue of making the user input information in the correct case.
- In the method I have tried to create a shapefile layer that uses the original 'full' index so I have all road features with which to work. I open the file and CanExecuteQuery returns true, but I receive the above error.
- I have tried to make the shapefile as private class variable and while it works for the map display, it still gives me the error with the query... If it is only opened in one place how can I have that lock issue - especially when I am selecting data only?
- I am not familiar with DataTable so my issue in figuring out how to get the data back out is separate (but any help is appreciated).
I'm really at a loss. I am new to the ThinkGeo components but they are very straightforward to use. I like them quite a bit. Any help you can provide is great. It would be nice for an option to have a case-insensitive search for GetFeaturesByColumnValue.
Thanks.
Edit: By the way, the Query works fine in MapExplorer: "Select FENAME From IN039lkA Where FENAME Like('%SUBURBAN%');"