MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   用Matlab获取Access数据库表的名称 (https://www.labfans.com/bbs/showthread.php?t=23562)

poster 2019-12-10 20:41

用Matlab获取Access数据库表的名称
 
我正在尝试使用Matlab获取Access数据库中所有表的列表。

到目前为止,我正在使用actxobject,并且可以针对数据库成功运行查询,但是我在[URL="https://stackoverflow.com/questions/201282/how-to-get-table-names-from-access"]这里[/URL]阅读的所有方法均失败了。

我始终收到错误消息“对MSysObjects没有读取权限”。该查询在Access程序中运行良好,但是我程序的实现不允许我将查询存储在该程序中。

因此,我的问题是:是否可以通过Matlab列出Access数据库的所有表?



[B]回答:[/B]

考虑以下代码:

conn = actxserver('ADODB.Connection'); connString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind.mdb'; conn.Open(connString); rs = conn.OpenSchema('adSchemaTables').GetRows; tableNames = rs(3, ismember(rs(4,:),'TABLE') ); 结果是:

>> tableNames' ans = 'Categories' 'Customers' 'Employees' 'Order Details' 'Orders' 'Products' 'Shippers' 'Suppliers'

[url=https://stackoverflow.com/questions/3100998]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 01:08

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.