数据库选择所有表问题

no_com 2002-03-29 08:05:21

'---------------------------grid1-------------
Grid1.Cols = 4
Grid1.TextMatrix(0, 0) = "序号"
Grid1.TextMatrix(0, 1) = "表名称"
Grid1.TextMatrix(0, 2) = "字段数"
Grid1.TextMatrix(0, 3) = "表中记录数"
Grid1.ColWidth(0) = 800
Grid1.ColWidth(3) = 1500
Grid1.Rows = 10
'--------------
Dim dbs As Database
Dim rst As Recordset
Dim tdf As TableDef
Set dbs = OpenDatabase(zhuan_2)
For j = 0 To dbs.TableDefs.Count - 1
If Left$(dbs.TableDefs(j).Name, 4) <> "MSys" Then
i = i + 1
'Grid1.AddItem Grid1.Rows + 1
'Grid1.Rows = i + 1
Grid1.TextMatrix(i, 0) = i
Grid1.TextMatrix(i, 1) = dbs.TableDefs(j).Name
Grid1.TextMatrix(i, 2) = dbs.TableDefs(j).Fields.Count
Grid1.TextMatrix(i, 3) = dbs.TableDefs(j).RecordCount

'dbs.TableDefs(i).Fields.Count
'MsgBox dbs.TableDefs(i).RecordCount & "|" & dbs.TableDefs(i).Fields.Count
End If
Next j
'---------------------------grid1-------------
Grid1.Cols = 4
Grid1.TextMatrix(0, 0) = "序号"
Grid1.TextMatrix(0, 1) = "表名称"
Grid1.TextMatrix(0, 2) = "字段数"
Grid1.TextMatrix(0, 3) = "表中记录数"
Grid1.ColWidth(0) = 800
Grid1.ColWidth(3) = 1500
Grid1.Rows = 10
'--------------
Dim dbs As Database
Dim rst As Recordset
Dim tdf As TableDef
Set dbs = OpenDatabase(zhuan_2)
For j = 0 To dbs.TableDefs.Count - 1
i = i + 1
'Grid1.AddItem Grid1.Rows + 1
'Grid1.Rows = i + 1
Grid1.TextMatrix(i, 0) = i
Grid1.TextMatrix(i, 1) = dbs.TableDefs(j).Name
Grid1.TextMatrix(i, 2) = dbs.TableDefs(j).Fields.Count
Grid1.TextMatrix(i, 3) = dbs.TableDefs(j).RecordCount

'dbs.TableDefs(i).Fields.Count
'MsgBox dbs.TableDefs(i).RecordCount & "|" & dbs.TableDefs(i).Fields.Count
Next j
++++++++++++++++++++++++++++++++++++++++
问题:
为什么我所得到的表中有五个是系统的?MSys开头的!?
...全文
8 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
gump2000 2002-03-29
if dbs.TableDefs(j).Attributes And dbSystemObject then
else
add your table
end if
回复
Fanks 2002-03-29
MDB中本来就有系统表,只是一般看不到而已,如果在选项中选择后则可以看到。
回复
no_com 2002-03-29
上面发错了!应该是这样!?如下:
'---------------------------grid1-------------
Grid1.Cols = 4
Grid1.TextMatrix(0, 0) = "序号"
Grid1.TextMatrix(0, 1) = "表名称"
Grid1.TextMatrix(0, 2) = "字段数"
Grid1.TextMatrix(0, 3) = "表中记录数"
Grid1.ColWidth(0) = 800
Grid1.ColWidth(3) = 1500
Grid1.Rows = 10
'--------------
Dim dbs As Database
Dim rst As Recordset
Dim tdf As TableDef
Set dbs = OpenDatabase(zhuan_2)
For j = 0 To dbs.TableDefs.Count - 1
i = i + 1
'Grid1.AddItem Grid1.Rows + 1
'Grid1.Rows = i + 1
Grid1.TextMatrix(i, 0) = i
Grid1.TextMatrix(i, 1) = dbs.TableDefs(j).Name
Grid1.TextMatrix(i, 2) = dbs.TableDefs(j).Fields.Count
Grid1.TextMatrix(i, 3) = dbs.TableDefs(j).RecordCount

'dbs.TableDefs(i).Fields.Count
'MsgBox dbs.TableDefs(i).RecordCount & "|" & dbs.TableDefs(i).Fields.Count
Next j
++++++++++++++++++++++++++++++++++++++++
问题:
为什么我所得到的表中有五个是系统的?MSys开头的!?
回复
no_com 2002-03-29
very good!
回复
发动态
发帖子

1181

社区成员

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