I'm trying to add a feature class to my Active Map from an SDE geodatabase connection. My code is as follows inside a button-click event:
string url = @"E:\WorkingFolder\SWATAddIn\GIS_TMP_Connection.sde\MG.dbo.APEX_SWAT_COMP_HUC8";
Uri uri = new Uri(url);
await QueuedTask.Run(() => LayerFactory.Instance.CreateLayer(uri, MapView.Active.Map));
However, it doesn't load and the error says it's unable to add data (doesn't explain why). If I remove the "MG.dbo." notation before the feature class name, it flags, "Data is not suppported."
What am I doing wrong?
Appreciate any help.
Solved! Go to Solution.
Hi y'all,
Found out the problem: The spatial table I was trying to add didn't have an OBJECTID. I modified the table to add an IDENTITY(1, 1) integer.
It's now loading. Easy to forget such things.
Hi y'all,
Found out the problem: The spatial table I was trying to add didn't have an OBJECTID. I modified the table to add an IDENTITY(1, 1) integer.
It's now loading. Easy to forget such things.