HI all!
I have map with FDO connection. In my base on server I have tables with geo data objects and other tables without geo data - street names, some specifications and other info. I want read and use data from non-spatial tables in my code. Somebody know how do it right?
There is a solution because in the past we also ask the Autodesk develop team. If you have ADN account you can find there the solution.
Kalmy
You can manupulate non-spatial data source using common database technolegies, ADO.net for example.
And I have a feeling that the same way to manupulate datasource with geomtry field works for non-spatial tables as well. Here is a code snippet to insert data into non-spatial table, just FYI.
[CommandMethod("InsertNoFeatureClass")]
public void InsertNonFeatureClass()
{
const string LAYERNAME = "FeatModel";
MgFeatureService featuerSvc = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as MgFeatureService;
//This is just for demonstration of the format of FeatureSourceId
AcMapMap currentMap = AcMapMap.GetCurrentMap();
MgLayerBase layer = null;
MgLayerCollection allLayers = currentMap.GetLayers();
foreach (MgLayerBase lyr in allLayers)
{
if (lyr.Name == LAYERNAME)
{
layer = lyr;
break;
}
}
//Just to demonstrate the format of FeatureSource
System.Windows.Forms.MessageBox.Show(layer.FeatureSourceId);
//Library://SDF_1.FeatureSource
// Insert into feature class
MgResourceIdentifier featureSourceId = new MgResourceIdentifier("Library://SDF_1.FeatureSource");
string className = "TTT:FeatData";
MgPropertyCollection properities = new MgPropertyCollection();
int randomFeatId = new Random().Next(100);
properities.Add(new MgInt32Property("FeatId",randomFeatId));
properities.Add(new MgStringProperty("FeatDes","Test"+randomFeatId.ToString()));
MgInsertFeatures insFeature = new MgInsertFeatures(className, properities);
MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
commands.Add(insFeature);
featuerSvc.UpdateFeatures(featureSourceId,commands,false);
}