This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes correct syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "correct syntax" Watch "correct syntax" New topic
Author

correct syntax

kelly devon
Ranch Hand

Joined: Apr 15, 2004
Posts: 75
hi all, please i need help in getting the correct syntax for a select statement that uses where and . what i mean is this; ("SELECT data FROM register WHERE date="+"'"+21+"'"+ AND+ "'"+22+"'"); i cant seem to get it right thank you.


kel
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Why are you not using a PreparedStatement? You are risking SQL injection by creating statements as you are.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: correct syntax