How to get database constraint violation error using EditOperation

2118
1
Jump to solution
03-13-2020 07:05 AM
BarbaraSchneider2
Occasional Contributor II

I am writing a feature to an Oracle Enterprise Geodatabase using an edit operation:

var editOperation = new EditOperation();

// Assign shape and attributes
var attributes = new Dictionary<string, object>();
attributes.Add(shapeFieldName, shape);
attributes.Add("myField", row["myField"]);

// Create new feature                
editOperation.Create(featClass, attributes);
bool succeeded = editOperation.Execute();‍‍‍‍‍‍‍‍‍‍

When executing the editOperation fails, I have no information what went wrong, i.e. if I violated a unique key constraint. Is there a possibilty to get the error? Or is there a better way to write features to an Enterprise Geodatabase?

Thanks, Barbara

0 Kudos
1 Solution

Accepted Solutions
SeanJones
Esri Regular Contributor

Hi Barbara,

If the EditOperation fails, the property EditOperation.ErrorMessage may contain the cause if known.

Otherwise you can enable an Oracle TRACE in the database to get detailed information from that side.

View solution in original post

1 Reply
SeanJones
Esri Regular Contributor

Hi Barbara,

If the EditOperation fails, the property EditOperation.ErrorMessage may contain the cause if known.

Otherwise you can enable an Oracle TRACE in the database to get detailed information from that side.