# Strange error with GetColumns and MsSql2008FeatureLayer

**URL:** <https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175>\
**Category:** WinForms\
**Created:** [February 20, 2013, 3:20pm UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175 "2013-02-20T15:20:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [February 20, 2013, 3:20pm UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/1 "2013-02-20T15:20:27Z")

</div>

Hello&nbsp;again,

We&nbsp;have&nbsp;been&nbsp;testing&nbsp;our&nbsp;deployment&nbsp;package&nbsp;using&nbsp;a&nbsp;clean&nbsp;Windows&nbsp;7&nbsp;&nbsp;operating&nbsp;system.&nbsp;No&nbsp;software&nbsp;is&nbsp;installed&nbsp;except&nbsp;for&nbsp;what&nbsp;is&nbsp;installed&nbsp;&nbsp;when&nbsp;the&nbsp;OS&nbsp;is&nbsp;installed.&nbsp;When&nbsp;we&nbsp;installed&nbsp;our&nbsp;project&nbsp;onto&nbsp;this&nbsp;&nbsp;machine&nbsp;we&nbsp;noticed&nbsp;a&nbsp;strange&nbsp;error&nbsp;which&nbsp;was&nbsp;happening&nbsp;when&nbsp;we&nbsp;attempted&nbsp;&nbsp;to&nbsp;call&nbsp;the&nbsp;following&nbsp;function:&nbsp;&nbsp;MsSqlServer2008FeatureLayer.FeatureSource.GetColumns.&nbsp;The&nbsp;really&nbsp;funny&nbsp;&nbsp;thing&nbsp;is&nbsp;that&nbsp;it&nbsp;does&nbsp;not&nbsp;fail&nbsp;when&nbsp;the&nbsp;'Table'&nbsp;property&nbsp;of&nbsp;the&nbsp;&nbsp;MsSqlServer2008FeatureLayer&nbsp;is&nbsp;a&nbsp;plain&nbsp;table,&nbsp;but&nbsp;only&nbsp;when&nbsp;you&nbsp;are&nbsp;&nbsp;trying&nbsp;to&nbsp;open&nbsp;data&nbsp;from&nbsp;a&nbsp;view.&nbsp;The&nbsp;view&nbsp;can&nbsp;be&nbsp;something&nbsp;as&nbsp;simple&nbsp;as&nbsp;&nbsp;"SELECT&nbsp;\*&nbsp;FROM&nbsp;Table".

Here&nbsp;is&nbsp;the&nbsp;the&nbsp;error&nbsp;with&nbsp;the&nbsp;stack&nbsp;trace:

`Exception Message:     Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)Exception Target Site: GetTypeByName ---- Stack Trace ----   System.RuntimeTypeHandle.GetTypeByName(name As String, throwOnError As Boolean, ignoreCase As Boolean, reflectionOnly As Boolean, stackMark As StackCrawlMarkHandle, loadTypeFromPartialName As Boolean, type As ObjectHandleOnStack)       GeoSuite.exe: N 00000   System.RuntimeTypeHandle.GetTypeByName(name As String, throwOnError As Boolean, ignoreCase As Boolean, reflectionOnly As Boolean, stackMark As StackCrawlMark&, loadTypeFromPartialName As Boolean)       GeoSuite.exe: N 00314   System.Type.GetType(typeName As String, throwOnError As Boolean)       GeoSuite.exe: N 00089   System.Data.SqlClient.SqlConnection.CheckGetExtendedUDTInfo(metaData As SqlMetaDataPriv, fThrow As Boolean)       GeoSuite.exe: N 00047   System.Data.SqlClient.SqlDataReader.GetFieldTypeInternal(metaData As _SqlMetaData)       GeoSuite.exe: N 6306756   System.Data.SqlClient.SqlDataReader.GetFieldType(i As Int32)       GeoSuite.exe: N 00155   System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo(mappingAction As MissingMappingAction, schemaAction As MissingSchemaAction, gettingData As Boolean, parentChapterColumn As DataColumn, chapterValue As Object)       GeoSuite.exe: N 6260166   System.Data.ProviderBase.SchemaMapping..ctor(adapter As DataAdapter, dataset As DataSet, datatable As DataTable, dataReader As DataReaderContainer, keyInfo As Boolean, schemaType As SchemaType, sourceTableName As String, gettingData As Boolean, parentChapterColumn As DataColumn, parentChapterValue As Object)       GeoSuite.exe: N 00414   System.Data.Common.DataAdapter.FillMappingInternal(dataset As DataSet, datatable As DataTable, srcTable As String, dataReader As DataReaderContainer, schemaCount As Int32, parentChapterColumn As DataColumn, parentChapterValue As Object)       GeoSuite.exe: N 00174   System.Data.Common.DataAdapter.FillMapping(dataset As DataSet, datatable As DataTable, srcTable As String, dataReader As DataReaderContainer, schemaCount As Int32, parentChapterColumn As DataColumn, parentChapterValue As Object)       GeoSuite.exe: N 00185   System.Data.Common.DataAdapter.FillFromReader(dataset As DataSet, datatable As DataTable, srcTable As String, dataReader As DataReaderContainer, startRecord As Int32, maxRecords As Int32, parentChapterColumn As DataColumn, parentChapterValue As Object)       GeoSuite.exe: N 00161   System.Data.Common.DataAdapter.Fill(dataTables As DataTable[], dataReader As IDataReader, startRecord As Int32, maxRecords As Int32)       GeoSuite.exe: N 00609   System.Data.Common.DbDataAdapter.FillInternal(dataset As DataSet, datatables As DataTable[], startRecord As Int32, maxRecords As Int32, srcTable As String, command As IDbCommand, behavior As CommandBehavior)       GeoSuite.exe: N 00371   System.Data.Common.DbDataAdapter.Fill(dataTables As DataTable[], startRecord As Int32, maxRecords As Int32, command As IDbCommand, behavior As CommandBehavior)       GeoSuite.exe: N 00504   System.Data.Common.DbDataAdapter.Fill(dataTable As DataTable)       GeoSuite.exe: N 00324   ThinkGeo.MapSuite.Core.MsSql2008FeatureSource.GetColumnsCore()       GeoSuite.exe: N 00784   ThinkGeo.MapSuite.Core.FeatureSource.GetColumns()       GeoSuite.exe: N 00057   MapUtilities.CustomSQLFeatureLayer.FindDisplayField()       CustomSQLFeatureLayer.vb: line 0295, col 07, IL 0034   MapUtilities.FeatureSelection.FindFeaturesInSelectableLayers(oFeatureLayers As GeoCollection`1, oSelectionRect As RectangleShape, oMap As CustomWinformsMap, oSelectedFeature As Feature&)       FeatureSelection.vb: line 0367, col 22, IL 0118   MapUtilities.FeatureSelection.DoSelection(oMap As CustomWinformsMap, oTrackSelectionShape As BaseShape&, eSelectionType As EnumMapTool, bShowNodes As Boolean, bControlKeyDown As Boolean)       FeatureSelection.vb: line 0174, col 13, IL 0121   GeoSuite.frmMain.TrackOverlayTrackEnded(sender As Object, e As TrackEndedTrackInteractiveOverlayEventArgs)       frmMain.vb: line 1791, col 16, IL 0178   ThinkGeo.MapSuite.DesktopEdition.TrackInteractiveOverlay.JBg=()       GeoSuite.exe: N 00560   ThinkGeo.MapSuite.DesktopEdition.TrackInteractiveOverlay.MouseUpCore(interactionArguments As InteractionArguments)       GeoSuite.exe: N 00160   ThinkGeo.MapSuite.DesktopEdition.TrackInteractiveOverlay.MouseClickCore(interactionArguments As InteractionArguments)       GeoSuite.exe: N 00169   ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ERY=(EhY= As InteractionArguments)       GeoSuite.exe: N 00255   8BM=.axU=.lhU=(lxU= As Object, mBU= As EventArgs)       GeoSuite.exe: N 00132   System.Windows.Forms.TimerNativeWindow.WndProc(m As Message&)       GeoSuite.exe: N 00073   System.Windows.Forms.NativeWindow.Callback(hWnd As IntPtr, msg As Int32, wparam As IntPtr, lparam As IntPtr)       GeoSuite.exe: N 00364`&nbsp;&nbsp;I&nbsp;find&nbsp;it&nbsp;interesting&nbsp;that&nbsp;it&nbsp;seems&nbsp;to&nbsp;be&nbsp;trying&nbsp;to&nbsp;load&nbsp;Microsoft.SqlServer.Types.dll&nbsp;v&nbsp;10.0.0.0.&nbsp;&nbsp;I&nbsp;repeat,&nbsp;the&nbsp;error&nbsp;does&nbsp;not&nbsp;happen&nbsp;if&nbsp;you&nbsp;are&nbsp;opening&nbsp;a&nbsp;regular&nbsp;table,&nbsp;only&nbsp;a&nbsp;view.&nbsp;&nbsp;Here's&nbsp;another&nbsp;hint.&nbsp;I&nbsp;loaded&nbsp;SQL&nbsp;Server&nbsp;Express&nbsp;2008R2&nbsp;onto&nbsp;the&nbsp;test&nbsp;machine&nbsp;and&nbsp;the&nbsp;error&nbsp;went&nbsp;away.&nbsp;I&nbsp;then&nbsp;uninstalled&nbsp;SQL&nbsp;Server&nbsp;Express&nbsp;and&nbsp;the&nbsp;error&nbsp;came&nbsp;back.&nbsp;&nbsp;I&nbsp;have&nbsp;written&nbsp;a&nbsp;small&nbsp;project&nbsp;with&nbsp;and&nbsp;install&nbsp;package&nbsp;that&nbsp;demonstrates&nbsp;the&nbsp;error,&nbsp;it's&nbsp;too&nbsp;big&nbsp;to&nbsp;attach&nbsp;but&nbsp;if&nbsp;you&nbsp;want&nbsp;it&nbsp;let&nbsp;me&nbsp;know&nbsp;and&nbsp;I&nbsp;will&nbsp;email&nbsp;it&nbsp;to&nbsp;you.

I&nbsp;get&nbsp;this&nbsp;error&nbsp;with&nbsp;both&nbsp;the&nbsp;Production&nbsp;and&nbsp;Development&nbsp;build.

Thanks!

Steve

&nbsp;

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [February 21, 2013, 3:39am UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/2 "2013-02-21T03:39:27Z")

</div>

Hi&nbsp;Steve,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Sorry&nbsp;that&nbsp;we&nbsp;are&nbsp;unable&nbsp;to&nbsp;reproduce&nbsp;the&nbsp;problem,&nbsp;I&nbsp;guess&nbsp;the&nbsp;problem&nbsp;is&nbsp;in&nbsp;the&nbsp;“plain&nbsp;table”&nbsp;mentioned&nbsp;in&nbsp;your&nbsp;post,&nbsp;could&nbsp;try&nbsp;there&nbsp;are&nbsp;2&nbsp;columns&nbsp;"feature&nbsp;Id"&nbsp;and&nbsp;"Geometry"&nbsp;in&nbsp;it?&nbsp;Actually,&nbsp;we&nbsp;tried&nbsp;generating&nbsp;a&nbsp;table&nbsp;which&nbsp;has&nbsp;the&nbsp;column&nbsp;of&nbsp;Geometry,&nbsp;and&nbsp;then&nbsp;generate&nbsp;a&nbsp;view&nbsp;from&nbsp;it,&nbsp;both&nbsp;query&nbsp;in&nbsp;the&nbsp;table&nbsp;and&nbsp;view&nbsp;works&nbsp;fine,&nbsp;also&nbsp;I&nbsp;test&nbsp;on&nbsp;the&nbsp;installed&nbsp;and&nbsp;Uninstalled&nbsp;SQL2008&nbsp;machines,&nbsp;everything&nbsp;goes&nbsp;well.&nbsp;Is&nbsp;it&nbsp;possible&nbsp;to&nbsp;give&nbsp;us&nbsp;a&nbsp;demo&nbsp;including&nbsp;the&nbsp;table&nbsp;schemal?issed.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Johnny&nbsp;

---

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [February 21, 2013, 8:09am UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/3 "2013-02-21T08:09:20Z")

</div>

Johnny,

Thanks&nbsp;for&nbsp;your&nbsp;reply.

The&nbsp;table&nbsp;structure&nbsp;is&nbsp;as&nbsp;follows:

`CREATE TABLE [dbo].[State](	[DMKey] [uniqueidentifier] NOT NULL,	[StateID] [bigint] NOT NULL,	[StateName] [nvarchar](25) NULL,	[StateAbbr] [nvarchar](2) NULL,	[StateFips] [nvarchar](2) NULL,	[SurveySyst] [tinyint] NULL,	[shape] [geometry] NOT NULL, CONSTRAINT [PK_State] PRIMARY KEY CLUSTERED (	[StateID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GOALTER TABLE [dbo].[State] ADD  CONSTRAINT [DF_State_DMKey]  DEFAULT (newid()) FOR [DMKey]GOALTER TABLE [dbo].[State]  WITH NOCHECK ADD  CONSTRAINT [enforce_srid_geometry_State] CHECK  (([shape].[STSrid]=(102003)))GOALTER TABLE [dbo].[State] NOCHECK CONSTRAINT [enforce_srid_geometry_State]GO`

Here&nbsp;is&nbsp;the&nbsp;view:

`create view [dbo].[vw_States] as select * from STATEGO`

I&nbsp;have&nbsp;also&nbsp;attached&nbsp;a&nbsp;simple&nbsp;project&nbsp;which&nbsp;I&nbsp;used&nbsp;for&nbsp;testing&nbsp;on&nbsp;my&nbsp;deplyment&nbsp;machine.&nbsp;I&nbsp;cannot&nbsp;reproduce&nbsp;the&nbsp;error&nbsp;on&nbsp;my&nbsp;development&nbsp;machine,&nbsp;so&nbsp;far&nbsp;I&nbsp;have&nbsp;only&nbsp;seen&nbsp;it&nbsp;on&nbsp;a&nbsp;clean&nbsp;install&nbsp;of&nbsp;Windows&nbsp;7,&nbsp;both&nbsp;32&nbsp;and&nbsp;64&nbsp;bit.&nbsp;If&nbsp;you&nbsp;build&nbsp;the&nbsp;project&nbsp;and&nbsp;deploy&nbsp;to&nbsp;a&nbsp;target&nbsp;OS&nbsp;maybe&nbsp;that&nbsp;will&nbsp;help.

Thanks&nbsp;again&nbsp;for&nbsp;your&nbsp;help!

Steve

&nbsp;

&nbsp;

&nbsp;

&nbsp;

[SqlServerGetColumnsTest.zip](https://community.thinkgeo.com/uploads/default/original/2X/1/1c9b71fb9fa809a2c8094145dc0b640f80238d84.zip) (14.2 KB)

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [February 22, 2013, 5:06am UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/4 "2013-02-22T05:06:36Z")

</div>

&nbsp;Hi&nbsp;Steven,

&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;sample,&nbsp;finnally&nbsp;i&nbsp;guess&nbsp;we&nbsp;find&nbsp;the&nbsp;problem,&nbsp;the&nbsp;reason&nbsp;is&nbsp;that&nbsp;you&nbsp;need&nbsp;to&nbsp;install&nbsp;“SQLSysClrTypes.msi”&nbsp;&nbsp;X86&nbsp;or&nbsp;X64&nbsp;on&nbsp;your&nbsp;deployment&nbsp;machine.&nbsp;&nbsp;just&nbsp;shown&nbsp;as&nbsp;following&nbsp;picture.

Here&nbsp;is&nbsp;the&nbsp;download&nbsp;link:

[microsoft.com/en-us/down...x?id=26728](http://www.microsoft.com/en-us/download/details.aspx?id=26728)

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

 ![](https://community.thinkgeo.com/uploads/default/original/2X/7/72d5eeb2ef5ff0d98f167eb8f5d22161dd67251d.png)

I&nbsp;have&nbsp;submitted&nbsp;this&nbsp;issue&nbsp;to&nbsp;our&nbsp;internal&nbsp;issue&nbsp;track&nbsp;system,&nbsp;we&nbsp;will&nbsp;try&nbsp;figure&nbsp;it&nbsp;out&nbsp;in&nbsp;near&nbsp;future.

Thanks,

Johnny

---

<div class="post-metadata">

**Author:** ![Steven1](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/steven1/32/18983_2.png) [@Steven1](https://community.thinkgeo.com/u/Steven1)\
**Post date:** [February 22, 2013, 10:43am UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/5 "2013-02-22T10:43:29Z")

</div>

Johnny,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;the&nbsp;workaround.&nbsp;I&nbsp;assume&nbsp;that&nbsp;somewhere&nbsp;the&nbsp;MapSuite&nbsp;application&nbsp;still&nbsp;has&nbsp;a&nbsp;dependency&nbsp;on&nbsp;the&nbsp;2008&nbsp;r2&nbsp;CLR&nbsp;types?&nbsp;Let&nbsp;me&nbsp;know&nbsp;when&nbsp;we&nbsp;no&nbsp;longer&nbsp;have&nbsp;to&nbsp;include&nbsp;them.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;again!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Steve

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [February 25, 2013, 4:22am UTC](https://community.thinkgeo.com/t/strange-error-with-getcolumns-and-mssql2008featurelayer/2175/6 "2013-02-25T04:22:27Z")

</div>

Hi&nbsp;Steven,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;very&nbsp;much&nbsp;for&nbsp;the&nbsp;understanding,&nbsp;I&nbsp;have&nbsp;push&nbsp;it&nbsp;to&nbsp;our&nbsp;development&nbsp;team&nbsp;with&nbsp;a&nbsp;very&nbsp;high&nbsp;priority.&nbsp;Any&nbsp;progress&nbsp;I&nbsp;will&nbsp;update&nbsp;it&nbsp;here.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;again!&nbsp;  
&nbsp;Johnny
