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

softman_2000 2002-03-31 09:13:44
这里谢谢了。
...全文
155 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
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表中读出的

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧