Below you will find some simple code to execute a query from a shapefilefeaturesource. Please substitute with your data and try it out. An exception of "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)" should appear on the ExecuteQuery line. If not, please inform me and I can perhaps supply my layer and we can verify what the exception is and why it is happening.............
Dim strSQL As String
Dim strColumnName As String = "ZONE"
Dim layerPath As String = "C:\Program Files\geotms\maps\lots.shp"
Dim layerName As String
Dim dt As New DataTable
If strColumnName <> Nothing Then
Dim layerToAddSHP As New ShapeFileFeatureLayer(layerPath, ShapeFileReadWriteMode.ReadOnly)
layerName = System.IO.Path.GetFileNameWithoutExtension(layerPath)
strSQL = "SELECT " & strColumnName & _
" FROM " & layerName & _
" GROUP BY " & strColumnName
layerToAddSHP.RequireIndex = False
Try
layerToAddSHP.Open()
dt = layerToAddSHP.QueryTools.ExecuteQuery(strSQL)
Finally
If layerToAddSHP.IsOpen Then layerToAddSHP.Close()
End Try
End If
End Sub