[mapguide-users] MgDateTimeException

Suja Sudhan suja.sudhan at atkinsglobal.com
Thu Sep 18 07:23:39 EDT 2008


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
> 

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



More information about the mapguide-users mailing list