Unable to create a new row in a featureclass in Enterprise gdb

191
3
Jump to solution
09-21-2023 12:35 PM
ViktorSafar
Occasional Contributor

I am trying to save a new feature into a SQL Server gdb table. The process succeeds (editOperation.ExecuteAsync returns true) and I even get the new feature's globalID. But I cannot see the new feature in the table using SQL Server Management Studio (querying by globalID).

(I call Project.Current.SaveEditsAsync() after the code below.)

I have been following this https://github.com/Esri/arcgis-pro-sdk/blob/e79fbb738b32dd178c089a6b321e2098f8c9c069/Examples/Geodat...

This is my code

using var gdb = new Geodatabase(SMARTConnectionsProvider.Connection);
using FeatureClass fc = gdb.OpenDataset<FeatureClass>(SMARTConnectionsProvider.SOMETABLE.TableName);

var editOperation = new EditOperation();
editOperation.Callback(context =>
{                
	using var rowBuffer = fc.CreateRowBuffer();
	rowBuffer[SMARTConnectionsProvider.SOMETABLE.Fields.RANGEID] = rangeId;
	rowBuffer[SMARTConnectionsProvider.SOMETABLE.Fields.SID] = smalId;
	rowBuffer[SMARTConnectionsProvider.SOMETABLE.Fields.SHAPE] = geometry;

	var newFeature = fc.CreateRow(rowBuffer);

	Log.Information($"GLOBALID {newFeature.GetGlobalID()}");                
}, fc);

return await editOperation.ExecuteAsync();

 

 

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Here are a few things to consider:

- Did Project.Current.SaveEditsAsync() return true?

- Do you see the newly added data in the table view in ArcGIS Pro ?

- Is your GeoDatabase versioned?  If so that might explain why you don't see the data using SQL Server.

View solution in original post

0 Kudos
3 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Here are a few things to consider:

- Did Project.Current.SaveEditsAsync() return true?

- Do you see the newly added data in the table view in ArcGIS Pro ?

- Is your GeoDatabase versioned?  If so that might explain why you don't see the data using SQL Server.

0 Kudos
ViktorSafar
Occasional Contributor

- Did Project.Current.SaveEditsAsync() return true?

Yes

 

- Do you see the newly added data in the table view in ArcGIS Pro ?

Just opened it now, yes, my data is the table when viewed via ArcGIS Pro. The data is not there when I query the same instance/table with the same connection detail via SSMS

 

- Is your GeoDatabase versioned?

I don't think so, or at least Pro is showing only the default version. 

0 Kudos
ViktorSafar
Occasional Contributor

Found out the feature class is indeed versioned and my data are in SOMETABLE_evw view.

in Pro - right click on the feature class - Properties - and there is says Versioning: Versioned

 

https://community.esri.com/t5/arcgis-enterprise-questions/can-t-see-new-data-in-databases-in-sql-ser...

0 Kudos