フィルターのクリア

Include table headers from SQL query without DatabaseTool Box

3 ビュー (過去 30 日間)
Dan Howard
Dan Howard 2018 年 4 月 17 日
As this is my first posting, please be patient as im still fairly new to Matlab. With the help from this forum I have found a way to use the ADODB connection string to make a connection to the SQL Database with a simple SQL query for test purposes ( without using the Database ToolBox).
connection_string = 'Provider = SQLOLEDB;Integrated Security=SSPI;Persist Security Info = False;Initial Catalogue = TESTDB;Data Source=TESTSERVER;'
conn = actxserver('ADODB.Connection');
conn.Open(connection_string);
test=conn.Execute('select * from TestTable');
table = test.GetRows();
end
The scrip above extracts every row from 'TestTable' and outputs the results into table using the GetRows ActiveX Method.
The only thing im trying to work out is on is if its possible to include the table headers? As the results are output into a table array called 'table' is there a way to include the headers from the SQL query using an ADODB method?
Is there a way to use the 'catch' 'try' error method in Matlab aswell? For ref. currently using 2015b version.
Any help would be gratefully appreciated.

回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by