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 commentaires

dpb
dpb le 9 Avr 2016
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?
yeah its just placeholders for illustrative purposes

Connectez-vous pour commenter.

Réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by