[mapguide-users] MgDateTimeException

Jackie C. Ng jumpinjackie at gmail.com
Thu Sep 18 07:45:03 EDT 2008


You could be onto something here. A recent change in the API (?) requires
that if you call any MgFeatureReader::GetXXX() method, that you should call
IsNull() on that property first, and then call the GetXXX() method if
IsNull() returns false. Otherwise an exception will be thrown if the
property in question is null.

- Jackie


Suja Sudhan wrote:
> 
> Thanks for your response Jackie. 
> 
> I later found that if a datetime field is null for a feature, then the
> error is thrown. Error is not thrown when the field has a valid value and
> the feature reader is populated without any issue. I am using MGE2008.
> Guess, null datetime values aren't accepted. Can someone confirm this
> please?
> 
> Thanks again.
> Suja
> 
> 
> 
> 
> Jackie C. Ng wrote:
>> 
>> 
>> It could be a bad filter string, what is the value of selectstring when
>> you
>> pass it to the MgFeatureQueryOptions object?
>> 
>> - Jackie
>> 
>> 
>> Suja Sudhan wrote:
>>> 
>>> 
>>> Hello All,
>>> 
>>> I am trying to get all the attributes of a layer and below is my code to
>>> do
>>> it. It works well for most of the layers but throws MgDateTimeException
>>> for
>>> couple of layers at the line of code where the feature reader is
>>> populated
>>> (pl see code below). What should be causing this, anything to do with
>>> the
>>> data?
>>> 
>>>             MgMap map = new MgMap();
>>>             map.Open(resService, mapName);
>>> 
>>>             //get the layer for which the attributes have to be got
>>>             MgLayerBase layer = map.GetLayers().GetItem(layerName);
>>> 
>>>             //get the layer class name
>>>             string layerClassName = layer.GetFeatureClassName();
>>> 
>>>             MgSelection selection = new MgSelection();
>>> 
>>>             //generate a selection string
>>>             string selectstring = selection.GenerateFilter(layer,
>>> layerClassName).ToString();
>>> 
>>>             //set the query option required for the reader to populate
>>>             MgFeatureQueryOptions featQueryOption = new
>>> MgFeatureQueryOptions();
>>>             featQueryOption.SetFilter(selectstring);
>>> 
>>>             //get the layer resource id
>>>             MgResourceIdentifier resId = new
>>> MgResourceIdentifier(layer.GetFeatureSourceId()); ;
>>>            
>>>             //populate feature reader
>>>             MgFeatureReader reader = featService.SelectFeatures(resId,
>>> layerClassName, featQueryOption);
>>> 
>>> The code throws MgDateTimeException (message: A date and/or time
>>> exception
>>> occurred.) at the above line.
>>> 
>>> Thanks,
>>> Suja
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/MgDateTimeException-tp19465653p19465653.html
>>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>> 
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://n2.nabble.com/MgDateTimeException-tp1086509p1096857.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>> 
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> 
>> 
>> -----
>> http://themapguyde.blogspot.com
>> 
>> http://www.linkedin.com/in/jackieng
>> 
> 
> 


-----
http://themapguyde.blogspot.com

http://www.linkedin.com/in/jackieng
-- 
View this message in context: http://www.nabble.com/MgDateTimeException-tp19465653p19550958.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list