[mapguide-users] Inserting MgDateTimeProperty to SQLServerSpatial
fails
Gunter Becker
gunter.becker at csogis.de
Tue Nov 10 09:21:54 EST 2009
Hi everyone,
I discovered a strange behavior when trying to add a MgDateTime to a
SqlServersSpatial featuresource:
To insert a DateTime-object into a featursource I first have to convert it
into a MgDateTime.
This code works fine when inserting a DateTime into a sdf featuresource:
...
DateTime dateTime = Convert.ToDateTime(propertyValue);
MgDateTime mgDateTime = new MgDateTime();
mgDateTime.SetYear(Convert.ToInt16(dateTime.Year));
mgDateTime.SetMonth(Convert.ToInt16(dateTime.Month));
mgDateTime.SetDay(Convert.ToInt16(dateTime.Day));
mgDateTime.SetHour(Convert.ToInt16(dateTime.Hour));
mgDateTime.SetMinute(Convert.ToInt16(dateTime.Minute));
mgDateTime.SetSecond(Convert.ToInt16(dateTime.Second));
MgProperty newProperty = new MgDateTimeProperty(propertyName,
mgDateTime);
...
Using SqlServer2008SpatialProvider this fails. I realized that it works when
using low values for
the day parameter and fails when using higher values. So I got the idea to
change my code in the following way and everything is correct:
mgDateTime.SetMonth(Convert.ToInt16(dateTime.Day));
mgDateTime.SetDay(Convert.ToInt16(dateTime.Month));
I could even evaluate this issue in AutoCAD Map 2010. So I think it's a
provider related issue, isn't it?
Where do I have to create a ticket: FDO Trac or MapGuide Trac ?
Thanks, Gunter
--
View this message in context: http://n2.nabble.com/Inserting-MgDateTimeProperty-to-SQLServerSpatial-fails-tp3979965p3979965.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list