这个问题可以通过ADOX.Catalog 来解决 1.工程引用 Microsoft ADO Ext. 2.8 for DDL And Security. 2.写一个函数 Private Function blnTableIsExist(strTableName As String) As Boolean Dim myCatalog As New ADOX.Catalog Dim intI As Integer myCatalog.ActiveConnection = ObjCnn '注意ObjCnn为你定义的数据库连接. For intI = 0 To myCatalog.Tables.Count - 1 If strTableName = myCatalog.Tables(intI).Name Then blnTableIsExist = True Exit For End If Next intI End Function我没有在VB里调试,直接手写了,请自己根据思路调试,如有问题我们接着讨论.
对了,在函数的末尾加上Set MyCatalog=Nothing
Answer is here: http://blog.csdn.net/online/archive/2004/09/08/98744.aspx?Pending=true Your question is too simple.Please read books and do a research before you raise questions.
1.工程引用 Microsoft ADO Ext. 2.8 for DDL And Security.
2.写一个函数
Private Function blnTableIsExist(strTableName As String) As Boolean
Dim myCatalog As New ADOX.Catalog
Dim intI As Integer
myCatalog.ActiveConnection = ObjCnn '注意ObjCnn为你定义的数据库连接.
For intI = 0 To myCatalog.Tables.Count - 1
If strTableName = myCatalog.Tables(intI).Name Then
blnTableIsExist = True
Exit For
End If
Next intI
End Function我没有在VB里调试,直接手写了,请自己根据思路调试,如有问题我们接着讨论.
http://blog.csdn.net/online/archive/2004/09/08/98744.aspx?Pending=true
Your question is too simple.Please read books and do a research before you raise questions.