mapxtreme2008 +c#+sql2005 读取日期型字段的问题(内存读写异常)
从sql2005取数据时,有一个日期型字段,mapxtreme获取数据时,直接报错(内存读取错误)
换成字符型就没有问题,代码如下
string sql = @"select TaxCollector_ID,Collect_Time,longitude,Latitude from TaxCollector_Locus_GIS where longitude<>0 ";
string tableAlias = "TaxCollector_Locus_GIS";
string colName = "Collect_Time";
//建立XY空间方案
MapInfo.Data.SpatialSchemaXY xy = new MapInfo.Data.SpatialSchemaXY();
xy.XColumn = "longitude";
xy.YColumn = "Latitude";
xy.NullPoint = "0.0, 0.0";
xy.StyleType = MapInfo.Data.StyleType.None;
xy.DefaultStyle = new MapInfo.Styles.CompositeStyle();
xy.CoordSys = MapInfo.Engine.Session.Current.CoordSysFactory.CreateLongLat(MapInfo.Geometry.DatumID.WGS84);
//建立TableInfo
MapInfo.Data.TableInfoServer ti = new MapInfo.Data.TableInfoServer(tableAlias, DB,sql, MapInfo.Data.ServerToolkit.Odbc);
ti.SpatialSchema = xy;
MapInfo.Data.Table miCustomers = MapInfo.Engine.Session.Current.Catalog.OpenTable(ti);
MapInfo.Mapping.FeatureLayer featureLayer = new MapInfo.Mapping.FeatureLayer(miCustomers);
m_MapControl.Map.Layers.Add(featureLayer);
m_MapControl.Map.SetView(featureLayer);