hi, i have a problem now and i think many people like me! please help, i tried to solve it but i can't
Ältere Kommentare anzeigen
i have a code below:
...
i = curs.Data{1}
update(connA, 'inputtb', {'Timeout'}, {'out'}, 'where ID = i')
...
in my project, ''i'' isn't constant. Because every time I find ID in my database, it return a new curs.Data{1} so I want ''i'' were a variable. Any time it return curs.Data{1}, the code update (below) will be execute, and ''i'' was imported value from curs.Data{1}. The problem is in whereclause, it seem like we can't put one variable into place ''i'' above!
Antworten (2)
Image Analyst
am 1 Mai 2013
Try making it a string with the number embedded with sprintf():
theQuery = sprintf('where ID = %d', i);
curs.Data{1} update(connA, 'inputtb', {'Timeout'}, {'out'}, theQuery)
By the way, having many people "like" you is not a problem - it's great. You have many friends. Better than have many people hate you. :-)
hoang
am 2 Mai 2013
0 Stimmen
4 Kommentare
Please post comments in the comment section, not as new answer.
Instead of writing "it doesn't work", a more detailed description of the occurring problems would be more helpful to suggest an improvement.
Image Analysts's suggestion seems to be perfect already:
id = 5;
theQuery = sprintf('where ID = %d', id)
update(connA, 'inputtb', {'Timeout'}, {'out'}, theQuery)
So what happens if you do this?
hoang
am 3 Mai 2013
Image Analyst
am 3 Mai 2013
I'm not sure what you're asking. What's your code for using the update() function? Actually I haven't used MATLAB with databases, so I'm not going to be any help.
hoang
am 4 Mai 2013
Kategorien
Mehr zu Database Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
