ThinkGeo Team,
I’ve run into two issues in V12.1 regarding ExecuteQuery. The exact same code runs under V10.6 without issue.
First, FeatureLayer.CanExecuteSqlQuery is always false for ShapeFileFeatureLayer. If an ExecuteQuery is attempted an Exception is encountered as shown below.
Second, FeatureLayer.ExecuteQuery when FeatureLayer is SqliteFeatureLayer returns an Exception for the following SqlStatement – Select * FROM [Transportation] as shown below.
However, the following ExecuteQuery for SqliteFeatureLayer returns the column schema as expected – Select * FROM [Transportation] Where 1=0.
I will send a DropBox link for the Transportation.sqlite FeatureLayer.
Both of these worked under V10.6.
Regards,
Dennis
Sql=Select * FROM [TransportationDup]
Source=ThinkGeo.Core
TargetSite=Void CheckFeatureSourceCanExecuteSqlQuery(Boolean)
StackTrace= at ThinkGeo.Core.ValidatorHelper.CheckFeatureSourceCanExecuteSqlQuery(Boolean canExecuteSqlQuery)
at ThinkGeo.Core.FeatureSource.ExecuteQuery(String sqlStatement)
at OriStarGeoCode.clsDbfFeatureSetItemsCollection.LoadDbfFeatureSetItem(String TheDatabase, String TheDatabaseTable, FeatureLayer& TheStreetsFeatures, Delegate TheProgressBar, Double TheRangeFactor) in C:\OriStarMappingIncThinkGeoUI-V12.1\OriStarGeoCode\clsDbfFeatureSet.cs:line 405
Message=Executing sql queries is not supported and the user should always check the CanExecuteSqlQueries to ensure the FeatureSource support it before calling.
System.InvalidOperationException: Executing sql queries is not supported and the user should always check the CanExecuteSqlQueries to ensure the FeatureSource support it before calling.
at ThinkGeo.Core.ValidatorHelper.CheckFeatureSourceCanExecuteSqlQuery(Boolean canExecuteSqlQuery)
at ThinkGeo.Core.FeatureSource.ExecuteQuery(String sqlStatement)
at OriStarGeoCode.clsDbfFeatureSetItemsCollection.LoadDbfFeatureSetItem(String TheDatabase, String TheDatabaseTable, FeatureLayer& TheStreetsFeatures, Delegate TheProgressBar, Double TheRangeFactor) in C:\OriStarMappingIncThinkGeoUI-V12.1\OriStarGeoCode\clsDbfFeatureSet.cs:line 405
TheDatabase=Transportation.sqlite, TheDatabaseTable=Transportation
Sql=Select * FROM [Transportation]
Source=System.Data.Common
TargetSite=Void set_Item(Int32, System.Object)
StackTrace= at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at ThinkGeo.Core.SqliteFeatureSource.ExecuteQueryCore(String sqlStatement)
at ThinkGeo.Core.FeatureSource.ExecuteQuery(String sqlStatement)
at OriStarGeoCode.clsDbfFeatureSetItemsCollection.LoadDbfFeatureSetItem(String TheDatabase, String TheDatabaseTable, FeatureLayer& TheStreetsFeatures, Delegate TheProgressBar, Double TheRangeFactor) in C:\OriStarMappingIncThinkGeoUI-V12.1\OriStarGeoCode\clsDbfFeatureSet.cs:line 405
Message=Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.Couldn’t store <System.Byte[]> in ColumnOrdinal Column. Expected type is Int32.
InnerException:
Source=System.Data.Common
TargetSite=Void Set(Int32, System.Object)
StackTrace= at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)
Message=Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.
System.ArgumentException: Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.Couldn’t store <System.Byte[]> in ColumnOrdinal Column. Expected type is Int32.
—> System.InvalidCastException: Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)
— End of inner exception stack trace —
at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at ThinkGeo.Core.SqliteFeatureSource.ExecuteQueryCore(String sqlStatement)
at ThinkGeo.Core.FeatureSource.ExecuteQuery(String sqlStatement)
at OriStarGeoCode.clsDbfFeatureSetItemsCollection.LoadDbfFeatureSetItem(String TheDatabase, String TheDatabaseTable, FeatureLayer& TheStreetsFeatures, Delegate TheProgressBar, Double TheRangeFactor) in C:\OriStarMappingIncThinkGeoUI-V12.1\OriStarGeoCode\clsDbfFeatureSet.cs:line 405