I have two point layers. If a feature from featurelayer A is removed, it is moved to another featurelayer B as the requirement is for archiving deleted features of A in featurelayer B. Its not working some how. similar thing worked for an earlier app.Found this error as well: RowError = "The fid value is invalid for a new feature, must be smaller than zero"here is the code: MapLayer layerTS = Map.MapLayers["xxxx"];
MobileCacheMapLayer mblCl1 = layerTS as MobileCacheMapLayer;
FeatureLayer featureTS = (FeatureLayer)(mblCl1.Layer);
MapLayer layerRTS = Map.MapLayers["Removedxxxx "];
MobileCacheMapLayer mblCl = layerRTS as MobileCacheMapLayer;
FeatureLayer featureRTS = (FeatureLayer)(mblCl.Layer);
FeatureDataTable ftableRTS = featureRTS.GetDataTable();
FeatureDataTable ftableTS = selectedDataRow.Table as FeatureDataTable;
FeatureDataRow editRow = ftableRTS.NewRow();
editRow.BeginEdit();
editRow.Geometry = selectedDataRow.Geometry;
foreach (DataColumn clm in featureTS.Columns)
{
if (featureRTS.Columns[clm.ColumnName] != null && clm.ColumnName != "SHAPE" && clm.ColumnName != "GlobalID")
{
if (ftableRTS.Columns.Contains(clm.ColumnName))
{
editRow[clm.ColumnName] = selectedDataRow[clm.ColumnName];
}
}
}
ClearDataTableErrors(ftableRTS);
ftableRTS.Rows.Add(editRow);
editRow.EndEdit();
cntEdit =featureRTS.SaveEdits(ftableRTS);
cntEdit = -1;
cntEdit = ftableRTS.SaveInFeatureLayer();
//remove from the feature class
foreach (FeatureDataRow row in ftableTS.Rows)
row.Delete();
cntEdit = -1;
if (ftableTS.AllowModify)
selectedDataRow.Delete();
cntEdit = ftableTS.SaveInFeatureLayer();
ftableTS.AcceptChanges();
ftableRTS.AcceptChanges();