AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Show records from non-spatial tables

2 REPLIES 2
Reply
Message 1 of 3
vipwall
691 Views, 2 Replies

Show records from non-spatial tables

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?

2 REPLIES 2
Message 2 of 3
AlbertKalman5692
in reply to: vipwall

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

 

Message 3 of 3

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);


        }



Daniel Du
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost