• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Query returning null

 
Anshal Patel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The above query returns a null,here disquery is type of string where as this thing returns proper answer


 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure disquery String has value before the query execution.

Just printout the query before the execution and see how the query is constructed.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with Servlets so moved to JDBC. Please choose forums carefully so you get the best possible answers.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When not using PreparedStatements you have to make sure things are quoted, so first make sure your variable is not null. Then you'll need code that looks like:



 
Anshal Patel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have printed the variable and it works fine

I just need to know how to bind the parameter and my project is all done.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anshal Patel wrote:i have printed the variable and it works fine

I just need to know how to bind the parameter and my project is all done.


Have a look at java.sql.PreparedStatement
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anshal Patel wrote:i have printed the variable and it works fine

I just need to know how to bind the parameter and my project is all done.


This will help you.
 
Anshal Patel
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
issue resolved thanks to all
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic