I use ArcGIS for Server. I have all of my data for my feature layer on that database. The point is being added by coordinates, but it is not saving to the database. I am getting the error "An error occurred in the database" in my server logs.
My code is below.
Here is the log:
<?xml version="1.0" encoding="utf-8" ?>
<Msg time='2014-03-31T11:06:05,468' type='SEVERE' code='17000' target='Calvert_City_Test.MapServer' methodName='GraphicFeatureLayer.Add' machine='ARCGIS-PC' process='696' thread='3204' user='anonymous' >A database error occurred.</Msg>
<Msg time='2014-03-31T11:06:05,810' type='SEVERE' code='17000' target='Calvert_City_Test.MapServer' methodName='GraphicFeatureServer.HandleREST_ApplyEditsOperation' machine='ARCGIS-PC' process='696' thread='3204' user='anonymous' >A database error occurred.</Msg>
<Msg time='2014-03-31T11:08:49,895' type='SEVERE' code='17000' target='Calvert_City_Test.MapServer' methodName='GraphicFeatureLayer.Add' machine='ARCGIS-PC' process='696' thread='3204' user='anonymous' >A database error occurred.</Msg>
<Msg time='2014-03-31T11:08:49,965' type='SEVERE' code='17000' target='Calvert_City_Test.MapServer' methodName='GraphicFeatureServer.HandleREST_ApplyEditsOperation' machine='ARCGIS-PC' process='696' thread='3204' user='anonymous' >A database error occurred.</Msg>
Each time I add it produces two error messages. This is showing me trying to add a feature two separate times.
Here is my XAML:
<esri:FeatureLayer ID="Meters"
Url="http://xx.xx.xxx.xx/arcgis/rest/services/Calvert_City_Test/FeatureServer/2"
MouseLeftButtonUp="FeatureLayer_MouseLeftButtonUp"
DisableClientCaching="True"
OnDemandCacheSize="0"
Mode="OnDemand"
AutoSave="False"
C#:
private void CorrectInformationButton_Click(object sender, RoutedEventArgs e)
{
CheckAddedPoint.Visibility = Visibility.Collapsed;
OptionsPortal.Visibility = Visibility.Visible;
FeatureLayer featurelayer = MyMap.Layers["Meters"] as FeatureLayer;
double latitude = Convert.ToDouble(addLat);
double longitude = Convert.ToDouble(addLong);
Graphic graphic = new Graphic()
{
Geometry = _mercator.FromGeographic(new MapPoint(longitude, latitude)),
Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
};
graphic.Attributes["OBJECTID"] = 244;
graphic.Attributes["PWSID"] = "55555";
graphic.Attributes["CIS_METR"] = addAccount;
graphic.Attributes["CUSTYPE"] = " ";
graphic.Attributes["SIZE"] = Convert.ToDouble(5);
graphic.Attributes["TYPE"] = " ";
graphic.Attributes["OTHTYPE"] = " ";
graphic.Attributes["MANUF"] = " ";
graphic.Attributes["MODEL"] = " ";
graphic.Attributes["YEAR"] = " ";
graphic.Attributes["TESTDATE"] = " ";
graphic.Attributes["MASTER"] = " ";
graphic.Attributes["MBOX"] = " ";
graphic.Attributes["MBOXTYPE"] = " ";
graphic.Attributes["PLACE"] = " ";
graphic.Attributes["STR"] = addStreet;
graphic.Attributes["CITY"] = addcity;
graphic.Attributes["COUNTY"] = " ";
graphic.Attributes["AGENCY_CON"] = " ";
graphic.Attributes["CONTACT"] = " ";
graphic.Attributes["LAST_UPDT"] = " ";
graphic.Attributes["XY_SOURCE"] = " ";
graphic.Attributes["XY_ISSUES"] = " ";
graphic.Attributes["COMMENTS"] = addName;
graphic.Attributes["SHAPE"] = null;
featurelayer.Graphics.Add(graphic);
featurelayer.SaveEdits();
}