以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  ADOX 怎样读出数据库视图的sql语句  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137763)

--  作者:淡月斜阳
--  发布时间:2019/7/15 10:17:00
--  ADOX 怎样读出数据库视图的sql语句
Dim constr As String="Provider=Microsoft.ACE.OLEDB.12.0;User ID=admin;Data Source=D:\\data.accdb;Persist Security Info=False"
Dim rdb As new adodb.Connection
Dim cat As new Adox.CataLog
rdb.open(constr )
cat.ActiveConnection =rdb
For i As Integer = 0 To Cat.views.Count -1
    Output.Show(Cat.VIews(i).Name)
    \'OUTPUT.Show(Cat.views(i).Command.Tostring )
Next
rdb.close

如图,把这段SQL语句给读出来
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20190715101643.png
图片点击可在新窗口打开查看

--  作者:淡月斜阳
--  发布时间:2019/7/15 10:32:00
--  
搞定了

Dim constr As String="Provider=Microsoft.ACE.OLEDB.12.0;User ID=admin;Data Source=D:\\data.accdb;Persist Security Info=False"
Dim rdb As new adodb.Connection
Dim cat As new Adox.CataLog
rdb.open(constr )
cat.ActiveConnection =rdb
For i As Integer = 0 To Cat.views.Count -1
    Output.Show(Cat.VIews(i).Name)
    Dim cmd As New ADODB.Command
     cmd=Cat.views(i).Command 
    OUTPUT.Show(cmd.CommandText)
Next
rdb.close