请问:知道一个ado的connection怎么样得到它连接的数据库中的所有表的名称

softman_2000 2002-03-31 09:13:44
这里谢谢了。
...全文
86 点赞 收藏 7
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
softman_2000 2002-04-02

多谢各位的帮忙,我就只能给80分,得分的两位我都比较满意,一人给四十分
没有太多得分了,见谅。
回复
ferrytang 2002-03-31
如果你连的是的sql server或者oracle那还可以知道
如果是access....
别犯傻了!
回复
miniant 2002-03-31
重写例子:
' BeginOwnersVB
Sub OwnersX()

Dim tblLoop As New ADOX.Table
Dim cat As New ADOX.Catalog
Dim strOwner As String

' Open the Catalog.
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\" & _
"Microsoft Office\Office\Samples\Northwind.mdb;" & _
"jet oledb:system database=" & _
"c:\Program Files\Microsoft Office\Office\system.mdw"

' Print the original owner of Categories
strOwner = cat.GetObjectOwner("Categories", adPermObjTable)
Debug.Print "Owner of Categories: " & strOwner

' Set the owner of Categories to Accounting
cat.SetObjectOwner "Categories", adPermObjTable, "Accounting"

' List the owners of all tables and columns in the catalog.
For Each tblLoop In cat.Tables
Debug.Print "Table: " & tblLoop.Name
Debug.Print " Owner: " & _
cat.GetObjectOwner(tblLoop.Name, adPermObjTable)
Next tblLoop


回复
miniant 2002-03-31
首先,引用Microsoft ADO Ext. 2.6 For DDL...(msadox.dll)文件
以下是一个例子:
Dim tblLoop As New ADOX.Table
Dim cat As New ADOX.Catalog
Dim strOwner As String

' Open the Catalog.
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\" & _
"Microsoft Office\Office\Samples\Northwind.mdb;" & _
"jet oledb:system database=" & _
"c:\Program Files\Microsoft Office\Office\system.mdw"

' Print the original owner of Categories
strOwner = cat.GetObjectOwner("Categories", adPermObjTable)
Debug.Print "Owner of Categories: " & strOwner
回复
water_j 2002-03-31
gz!
回复
snakeyin 2002-03-31
同意ferrytang(四眼丑田雞)
回复
ufcr 2002-03-31
sql server是从系统表sysobjects表中读出的
回复
发动态
发帖子

1181

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
社区公告
暂无公告