判断一个文件是否存在. (需要引用 Microsoft Scripting Runtime 库)Public Function HasFile(fn As String) As BooleanOn Error GoTo handler Dim fso As New FileSystemObject Dim dataFile As File Set dataFile = fso.GetFile(fn) Set dataFile = Nothing HasFile = True Exit Function
handler: HasFile = False End Function
ADOX 库简介: Microsoft® ActiveX® Data Objects Extensions for Data Definition Language and SecurityCatalog 表示一个数据库Dim cat as new Catalog Catalog.ActiveConnection = "OLEDB 数据源连接串..."Catalog.Tables 属性表示数据库中表集合. 你可以搜索这个表集合以确定是否存在指定的表Catalog.Views 属属性表示数据库中视图集合. 你可以搜索这个视图集合以确定是否存在指定的视图Table.Columns 属性表示列集合, 你可以搜索这个列集合以确定是否存在指定的列还有 Catalog.Procedures 性性表示存储过程集合, Table.Indexes 表示 索引集合等等
Dim fso As New FileSystemObject
Dim dataFile As File
Set dataFile = fso.GetFile(fn)
Set dataFile = Nothing
HasFile = True
Exit Function
handler:
HasFile = False
End Function
Catalog.ActiveConnection = "OLEDB 数据源连接串..."Catalog.Tables 属性表示数据库中表集合. 你可以搜索这个表集合以确定是否存在指定的表Catalog.Views 属属性表示数据库中视图集合. 你可以搜索这个视图集合以确定是否存在指定的视图Table.Columns 属性表示列集合, 你可以搜索这个列集合以确定是否存在指定的列还有 Catalog.Procedures 性性表示存储过程集合, Table.Indexes 表示 索引集合等等