ThinkGeo.com    |     Documentation    |     Premium Support

Edit/Delete Shape using MsSql2008FeatureLayer

I am using MsSql2008FeatureLayer.



Now I am Edit/Delete the Shape. In thinkgeo, example is given for it but it is using “ShapeLayer”, but I am using MsSql2008FeatureLayer.



So how can I edit/delete the shape in MsSql2008FeatureLayer?



Declaration is as below in View:



Dim sql2008Layer As MsSql2008FeatureLayer = New MsSql2008FeatureLayer(connectString, tableName, tableField, srid)
                                              
                                              sql2008Layer.ConnectionString = connectString
                                              sql2008Layer.TableName = tableName
                                              sql2008Layer.FeatureIdColumn = tableField
                                              sql2008Layer.Srid = srid
                                                                                            
                                              sql2008Layer.Open()
                                              sql2008Layer.MakeAllGeometriesValid()
                                              sql2008Layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(180, 102, 255, 102), 10, GeoColor.StandardColors.DarkGreen, 1)
                                              sql2008Layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 4, True)
                                              sql2008Layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 102, 255, 102), GeoColor.StandardColors.DarkGreen, 1)
                                              sql2008Layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
                                              sql2008Layer.DrawingQuality = DrawingQuality.HighQuality
                                                                                 
                                              ''overlays.LayerOverlay(“DynamicOverlay”, False, TileType.SingleTile).Layer(“sql2008Layer”, sql2008Layer)
                                              overlays.LayerOverlay(“DynamicOverlay”).Layer(“sql2008Layer”, sql2008Layer).IsBaseOverlay(False).TileType(TileType.SingleTile)



Can anyone help??

Hi Vivek, 
  
 Thanks for your post, following code should be helpful: 
             MsSql2008FeatureSource msSqlSource = msSql2008FeatureLayer.FeatureSource as MsSql2008FeatureSource; 
             msSqlSource.Open(); 
             msSqlSource.BeginTransaction(); 
             msSqlSource.UpdateFeature(yourfeature); //msSqlSource.DeleteFeature(yourfeature); 
             msSqlSource.CommitTransaction(); 
             msSqlSource.Close(); 
 if you have any more question , please feel free to let us know. 
  
 Best Regards 
  
 Summer