|
技术资料:修改mapx实体的数据集(tab or db)的值
当修改了某实体的数据值后,如何将修改写入它的数据集(图层或数据库),使用实体的rowvalue属性,参看下面的代码。
Dim lyr As MapXLib.Layer
Dim ds As MapXLib.Dataset
Dim ftrs As MapXLib.Features
Dim f As MapXLib.Feature
Dim rvs As MapXLib.RowValues
Dim rv As MapXLib.RowValue
'Get the layer to create a dataset for
Set lyr = Map1.Layers.Item("US Capitals")
'Open the dataset
Set ds = Map1.Datasets.Add(miDataSetLayer, lyr)
'Get the feature to update
Set ftrs = lyr.Search("capital like ""albany""")
Set f = ftrs.Item(1)
'Get the row to update
Set rvs = ds.RowValues(f)
'Get the column to update
Set rv = rvs.Item("Capital")
'Change the value
rv.Value = "New Albany"
'Update the feature and dataset with the new value
f.Update True, rvs
ds.Refresh |
|