how to save select query string value in a variable
Mostrar comentarios más antiguos
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 comentarios
dpb
el 9 de Abr. de 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?
Usama Arshad
el 21 de Abr. de 2016
Respuestas (0)
Categorías
Más información sobre Other Formats en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!