ESRI.ArcGIS.Mobile
SaveInFeatureSource Method
See Also  Example Send Feedback
ESRI.ArcGIS.Mobile.FeatureCaching Namespace > FeatureDataTable Class : SaveInFeatureSource Method

Save the updates made in the FeatureDataTable in the FeatureSource.

Syntax

Visual Basic (Declaration) 
Public Function SaveInFeatureSource() As Integer
C# 
public int SaveInFeatureSource()

Exceptions

ExceptionDescription
InvalidOperationExceptionFeatureSource not defined.

Example

The example below demonstrates how to store edits made to the cached layer and how to post them back to the server. The sample assumes that you have a point featuresource available in your MobileService, and is editable (which implies that the data has to be hosted in ArcSDE).
C#Copy Code
// Get first layer from the cache (assuming it's a point layer) 
 FeatureSource fsource = m_mobilecache.FeatureSources[ 0] as FeatureSource; 
 FeatureDataTable fdt = fsource.GetDataTable(); 
  
// Create new feature 
DataRow row = fdt.NewRow(); 
  
// Add geometry 
row[fdt.GeometryColumnIndex] = new ESRI.ArcGIS.Mobile.Point(e.MapCoordinate); 
 
// Add attribute value (assumes field Value exists in the layer) 
row["Value"] = 100; 
 
// Add new feature to the FeatureDataTable 
fdt.Rows.Add(row); 
  
// Store changes made to FeatureDataTable in the local cache 
fdt.SaveInFeatureSource(); 
  
Post updates back to server. You can also update selected layers only by passing a collection of layers. 
mobileCacheSyncAgent.Synchronize();

Remarks

SaveInFeatureSource will push updates occurring in FeatureDataTable to MobileService. To further post the updates back to server, use SyncAgents.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also