| Author |
how to use 'where' clause
|
gaurav chhabra
Ranch Hand
Joined: Jul 24, 2004
Posts: 109
|
|
sir i m using MS ACCESS and writing the query... String query = "select * from general_information where id = '" + id5+ "'"; id is "int" and id5 is also an "int".... id5 is a variable....of int type but if i write the above query then it is giving no result but if i m writing ... String query = "select * from general_information where id = 10 "; then it is working........ please tell me for the query........ thank you gaurav
|
 |
David Ulicny
Ranch Hand
Joined: Aug 04, 2004
Posts: 724
|
|
|
try to remove ' '
|
SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
|
 |
Avi Abrami
Ranch Hand
Joined: Oct 11, 2000
Posts: 1112
|
|
Gaurav, In my opinion, better to use a "PreparedStatement". [NOTE: Below code is uncompiled and untested.] Good Luck, Avi.
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Actually, integer/number literals should not be in single quotes. Better use PreparedStatement, as said earlier. By the way, why you kept "id5" in single quotes and "10" without quote, both are integers/numbers though.
|
 |
 |
|
|
subject: how to use 'where' clause
|
|
|