阅读:4014回复:4
arcsde中的数据编辑问题
不要在arcsde中注册你的layer,在mo中无法编辑已经注册的层.
用一些参数连接sde,你就可以进行编辑 Dim moConSDE As New MapObjects2.DataConnection moConSDE.Server = "SDE80:papagaio" 'server name moConSDE.Database = "instance=port:5151" 'SDE 'service, connecting by Oracle moConSDE.User = "XXX" 'user name with permission 'to access your layer moConSDE.Password = "XXX" 'password moConSDE.Connect 得到一个图层: Dim moLy as New MapObjects2.MapLayer Dim strLyName as string 'AAA is the owner of the layer 'AL is the name of the layer 'Points is the shapetype strLyName = "AAA.AL.SHAPE.Points" Set moLy.GeoDataset= moConSDE.FindGeoDataset(strLyName) 添加新的记录: Dim moRecs as New MapObjects2.Recordset Dim moPt as New MapObjects2.Point Set moRecs = moLy.Records Set moRecs = moLyMerc.Records moRecs.StartTransaction moRecs.AddNew moRecs("shape").Value = moPt moRecs.Update moRecs.CommitTransaction moRecs.StopEditing 删除当前记录: moRecs.StartTransaction moRecs.Edit moRecs.Delete moRecs.Update moRecs.CommitTransaction moRecs.StopEditing 修改当前的记录: moRecs.StartTransaction moRecs.Edit moRecs("name").Value = "test" moRecs.Update moRecs.CommitTransaction moRecs.StopEditing 88.. |
|
|
1楼#
发布于:2003-08-28 11:04
删除应该没有问题,可是添加时有没有遇到添加的要素sde钟记录明明存在,但就是看不到的现象呢??? 原因好像是sde中添加的要素不会自动拓展该层的extent,即如果添加的要素在该层原来的extent之外,那么这个要素就看不到。。。而shape文件会自动拓展,所以不论加在哪里都可以看得到。。。我原来做的时候是这样,不知现在怎样? 随便说说。。。。
|
|
|
2楼#
发布于:2003-08-28 11:06
另外,mo中addgeodataset不支持sde,所以不能新建sde层。。。
|
|
|
3楼#
发布于:2003-08-30 13:58
up
|
|
4楼#
发布于:2003-09-01 09:55
听说用c api的方法可以增加sde图层,so 麻烦,没做过,现在改用ao做电力,兄弟们加油!
|
|
|