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!