Hi,
I am using the full version of MSD, 5.0.0.0.
Ever since I upgraded to this version I get the following error when I try to use method GetBoundingBox on MsSql2008FeatureLayer:
System.InvalidCastException was unhandled
Message=Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
Source=MapSuiteCore
StackTrace:
at ThinkGeo.MapSuite.Core.MsSql2008FeatureSource.GetBoundingBoxCore()
at ThinkGeo.MapSuite.Core.FeatureSource.GetBoundingBox()
at ThinkGeo.MapSuite.Core.FeatureLayer.GetBoundingBoxCore()
at ThinkGeo.MapSuite.Core.Layer.GetBoundingBox()
at Post7709Sample.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\steller\Documents\Visual Studio 2010\Projects\ThinkGeo\7709 Sample\Post7709Sample\Form1.vb:line 19
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Post7709Sample.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Here is the code:
Is this a bug?
Dim sConnect As String = "SERVER=server;Database=database;UID=sa;PWD=pwd"
Dim oSQLLayer As New MsSql2008FeatureLayer(sConnect, "TRACT", "OBJECTID", 26916)
oSQLLayer.Open()
Dim staticOverlay As New LayerOverlay()
staticOverlay.Layers.Add("TRACT", oSQLLayer)
WinformsMap1.Overlays.Add(staticOverlay)
WinformsMap1.CurrentExtent = oSQLLayer.GetBoundingBox()
Thanks,
Steve