how to save select query string value in a variable
古いコメントを表示
conn = database('DataBase_Name','Userid','pwd','Vendor','Microsoft SQL Server', ...
'Server','localhost','AuthType','Windows','portnumber',1433);
file_path = 'rootfolder\subfolder\images\001.jpg';
sqlquery = sprintf('select * from example_table WHERE file_name = (''%s'')', file_path);
curs = exec(conn,sqlquery);
curs = fetch(curs);
curs.Data;
close(curs);
I want to get the string from curs.Data but it is not permitting me to put into a variable.
2 件のコメント
dpb
2016 年 4 月 9 日
The code snippet above doesn't even try so what isn't "permitting" you to use a variable for the result? Errors, or simply didn't incorporate an assignment statement as above?
I don't have the Toolbox so can't check but it doesn't look like the connection above would work with literal strings as are...or are they known just placeholders for illustrative purposes not your actual code?
Usama Arshad
2016 年 4 月 21 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Other Formats についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!