一个小项目里用到的,由于系统要求精简,故选择了简单的access,以前尝试过获得sql server的所有用户表名,sql server的sysobjects表中,用户表类型使用'U'标志,'S'是系统表
但发现这个无法运用在access上,现在只能南辕北辙般的在代码层上动手脚ado.net,通过下面的手段获得表名
先这样将就着,大家有什么好办法吗?
select name from sysobjects where type='U'
但发现这个无法运用在access上,现在只能南辕北辙般的在代码层上动手脚ado.net,通过下面的手段获得表名
Dim MyConn As OleDbConnection = New OleDbConnection(myspclass.ConnStr)
MyConn.Open()
Dim schemaTable As DataTable = MyConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For i As Integer = 0 To schemaTable.Rows.Count - 1
listbox1.Items.Add(schemaTable.Rows(i).Item(2).ToString())
Next
MyConn.Open()
Dim schemaTable As DataTable = MyConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For i As Integer = 0 To schemaTable.Rows.Count - 1
listbox1.Items.Add(schemaTable.Rows(i).Item(2).ToString())
Next
先这样将就着,大家有什么好办法吗?