Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: sql query-passing variable error
Replies: 3   Last Post: Jun 22, 2013 1:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
kainat ali

Posts: 18
Registered: 12/26/12
sql query-passing variable error
Posted: Feb 20, 2013 2:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm taking input from user on Command Window and storing that input in a variable (UserInput). After this I'm trying to pass this information to the sql query to select the data from database:

query2 = strcat(strcat('select Column1 from Table where Column2=''', UserInput), '''')
curs1 = exec(conn,query2)
final = fetch(curs1)
final1 = fetch(conn,query2)

The following error comes:

Error using database/fetch (line 37)
Second argument must be either a query string or object of type sqlOutput

Error in recipe (line 23)
final1 = fetch(conn,query2)

What I understand is that the query2 that its taking, it is taking as a string instead of sql query. What should I do to make it recognize as an sql query instead of a string.




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.