您好,看了数据和代码,首先你的第一个数据集有4个方柱,第三个数据集中有一个圆柱,替换代码修改如下:
publicvoidRecordsetSampleB(Workspace workspace) { DatasetVectordataset_world = workspace.Datasources[0].Datasets["圆柱"] asDatasetVector; Recordset recordset_world = dataset_world.GetRecordset(false, CursorType.Dynamic);//获取圆柱记录集 DatasetVector dataset = workspace.Datasources[0].Datasets["柱"] asDatasetVector; Recordset R= dataset.GetRecordset(false, CursorType.Dynamic)//获取方柱记录集 Recordset recordset = dataset_world.Query("SmID=3", CursorType.Static); recordset.MoveFirst(); recordset.delete(); //删除掉目标方柱 recordset.Update(); recordset.Close(); Geometrygeometry = recordset_world.GetGeometry();//获取圆柱对象 R.AddNew(geometry);//将圆柱对象添加至原方柱数据集 geometry.Dispose(); recordset.Dispose(); recordset_world.Dispose();
效果如下:
https://pan.baidu.com/s/1y5vNCabzRFdsCG4VGuq_Sg