用VB怎样查一个ACCESS表是否存在?
如题
谢谢!
问题点数:20、回复次数:3Top
1 楼victorycyz(--)回复于 2003-06-02 15:09:32 得分 5
select [name] from msysobjects where [name]=你要查找的表Top
2 楼lihonggen0(李洪根,MS MVP,标准答案来了)回复于 2003-06-02 15:50:13 得分 15
'*********************************************************
'* 名称:TableExists
'* 功能:判断表是否存在(表名)
'* 用法:TableExists(表名) adoCN是一个SQL的连接
'*********************************************************
Public Function TableExists(findTable As String) As Boolean
Dim rstSchema As New ADODB.Recordset
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
rstSchema.Find "TABLE_NAME='" & findTable & "'"
If rstSchema.EOF Then
TableExists = False
Else
TableExists = True
End If
rstSchema.Close
End Function
Top
3 楼zhenyukeji(美丽新家)回复于 2003-06-02 16:00:10 得分 0
select [name] from msysobjects where [name]=你要查找的表
Top




