Getting names of Access database tables with Matlab

冷暖自知 提交于 2019-11-28 05:03:02

问题


I'm trying to get a listing of all tables in an Access database using Matlab.

I'm so far using an actxobject and can successfull run queries against the database, but all methods I've read here have failed.

I consistently get the error message 'No read permission on MSysObjects'. The query runs fine within the Access-program, but the implementation of my program does not allow me to store the query there.

So, my question is: Is there any way to list all the tables of an Access database through Matlab?


回答1:


Consider this code:

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') );

and the result is:

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


来源:https://stackoverflow.com/questions/3100998/getting-names-of-access-database-tables-with-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!