阅读:1428回复:3
在AO中如何删掉一个shapefile文件?
在AO中如何删掉一个shapefile文件?希望高人指点,虽然很简单,但是我没找到。
|
|
1楼#
发布于:2004-08-30 13:20
<P>也可以直接采用filesystemobject 来做处理,主要是对shp file family 的几个扩展名文件分别删除即可。</P><P>.shp ,.shx ....</P>
|
|
|
2楼#
发布于:2004-08-30 13:15
Public Function DeleteFile(sDir As String, sName As String) As Boolean
On Error GoTo EH Dim pDS As IDataset ' try shapefile Dim pFClass As IFeatureClass Set pFClass = dbUtil.OpenShapeFile(sDir, sName) If (Not pFClass Is Nothing) Then Set pDS = pFClass pDS.Delete DeleteFile = True Exit Function End If ' try raster Dim pRD As IRasterDataset Set pRD = dbUtil.OpenRasterDataset(sDir, sName) If (Not pRD Is Nothing) Then Set pDS = pRD pDS.Delete DeleteFile = True Exit Function End If ' try tin Dim pTin As ITin Set pTin = dbUtil.OpenTin(sDir, sName) If (Not pTin Is Nothing) Then Set pDS = pTin pDS.Delete DeleteFile = True Exit Function End If ' try ordinary file Dim fs As FileSystemObject Set fs = New FileSystemObject If (fs.FileExists(sDir ; "\" ; sName)) Then fs.DeleteFile (sDir ; "\" ; sName) DeleteFile = True Exit Function End If DeleteFile = False Exit Function EH: SetError 1, Err.Description DeleteFile = False End Function |
|
|
3楼#
发布于:2004-08-30 10:09
是删除文件吗?还是删除geodatbase里的数据集?如果是删除文件,可以直接对文件操作,不需要使用ao的接口了
|
|
|