14 个解决方案
#1
用ADOX
需要的化留个EMAL 我发个源程序给你
需要的化留个EMAL 我发个源程序给你
#2
zaobao_0@163.com
谢谢
谢谢
#3
多谢各位的关心,我已经解决了。
用 Connect.OpenSchema ,不知道各位所指的ADOX是不是这个。
用 Connect.OpenSchema ,不知道各位所指的ADOX是不是这个。
#4
Private Sub Form_Load()
Dim adoCN As New ADODB.Connection '定义数据库的连接存放数据和代码Dim rstSchema
Dim strCnn As New ADODB.Recordset
str1 = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=wktrade;Data Source=net5"
adoCN.Open str1
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
out = out & "Table name: " & _
rstSchema!TABLE_NAME & vbCr & _
"Table type: " & rstSchema!TABLE_TYPE & vbCr
rstSchema.MoveNext
Loop
rstSchema.Close
adoCN.Close
Debug.Print out
End Sub
Dim adoCN As New ADODB.Connection '定义数据库的连接存放数据和代码Dim rstSchema
Dim strCnn As New ADODB.Recordset
str1 = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=wktrade;Data Source=net5"
adoCN.Open str1
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
out = out & "Table name: " & _
rstSchema!TABLE_NAME & vbCr & _
"Table type: " & rstSchema!TABLE_TYPE & vbCr
rstSchema.MoveNext
Loop
rstSchema.Close
adoCN.Close
Debug.Print out
End Sub
#5
如果想有选择的获取所有的表呢?例如获取所有用户建立的表
#6
在SQL SERVER里面
SELECT *
FROM sysobjects
WHERE xtype = 'u'
SELECT *
FROM sysobjects
WHERE xtype = 'u'
#7
up
#8
to lihonggen0(李洪根,用VB,标准答案来了) :
SQL SERVER有点小问题哦:
select name from sysobjects where type = 'U' AND status>0
SQL SERVER有点小问题哦:
select name from sysobjects where type = 'U' AND status>0
#9
select * from sysobjects where xtype = 'U' AND status>=0
#10
to : gump2000(阿甘)
你的条件错了status>=0
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
你的条件错了status>=0
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
#11
to gump2000(阿甘)
status>=0才对
你执行这条语句,可以得到结果
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
status>=0才对
你执行这条语句,可以得到结果
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
#12
用ADO的擴展:ADOX
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
#13
用ADO的擴展:ADOX
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
#14
ok
#1
用ADOX
需要的化留个EMAL 我发个源程序给你
需要的化留个EMAL 我发个源程序给你
#2
zaobao_0@163.com
谢谢
谢谢
#3
多谢各位的关心,我已经解决了。
用 Connect.OpenSchema ,不知道各位所指的ADOX是不是这个。
用 Connect.OpenSchema ,不知道各位所指的ADOX是不是这个。
#4
Private Sub Form_Load()
Dim adoCN As New ADODB.Connection '定义数据库的连接存放数据和代码Dim rstSchema
Dim strCnn As New ADODB.Recordset
str1 = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=wktrade;Data Source=net5"
adoCN.Open str1
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
out = out & "Table name: " & _
rstSchema!TABLE_NAME & vbCr & _
"Table type: " & rstSchema!TABLE_TYPE & vbCr
rstSchema.MoveNext
Loop
rstSchema.Close
adoCN.Close
Debug.Print out
End Sub
Dim adoCN As New ADODB.Connection '定义数据库的连接存放数据和代码Dim rstSchema
Dim strCnn As New ADODB.Recordset
str1 = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=wktrade;Data Source=net5"
adoCN.Open str1
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
out = out & "Table name: " & _
rstSchema!TABLE_NAME & vbCr & _
"Table type: " & rstSchema!TABLE_TYPE & vbCr
rstSchema.MoveNext
Loop
rstSchema.Close
adoCN.Close
Debug.Print out
End Sub
#5
如果想有选择的获取所有的表呢?例如获取所有用户建立的表
#6
在SQL SERVER里面
SELECT *
FROM sysobjects
WHERE xtype = 'u'
SELECT *
FROM sysobjects
WHERE xtype = 'u'
#7
up
#8
to lihonggen0(李洪根,用VB,标准答案来了) :
SQL SERVER有点小问题哦:
select name from sysobjects where type = 'U' AND status>0
SQL SERVER有点小问题哦:
select name from sysobjects where type = 'U' AND status>0
#9
select * from sysobjects where xtype = 'U' AND status>=0
#10
to : gump2000(阿甘)
你的条件错了status>=0
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
你的条件错了status>=0
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
#11
to gump2000(阿甘)
status>=0才对
你执行这条语句,可以得到结果
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
status>=0才对
你执行这条语句,可以得到结果
SELECT name, xtype, type, status
FROM sysobjects
WHERE type = 'U' AND status >= 0
ORDER BY name
#12
用ADO的擴展:ADOX
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
#13
用ADO的擴展:ADOX
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
Dim MyAdox1 As ADOX.Catalog
Set MyAdox1 = New ADOX.Catalog
Dim Tb1 As ADOX.Table
Set MyAdox1.ActiveConnection = MyCn1 'MyCn1為已打開數據庫的Ado Connection對象
For Each Tb1 In MyAdox1.Tables
'Tb1.Name ' 表的名字
next
#14
ok