jsp/mysql syntax


 Is this syntax correct because it throwsan error for me:  
 ResultSet rs1 = stmt.executeQuery("select password from userdesc where password like \""+pass+"\"" and name like \""+name+"\"");
RonayneAsked:
Who is Participating?
 
Nick_72Connect With a Mentor Commented:
Hello,

try this:

ResultSet rs1 = stmt.executeQuery("select password from userdesc where password like \""+pass+"\" and name like \""+name+"\"");
0
 
Nick_72Commented:
although I prefer single quotes since there's no need for escape characters:

ResultSet rs1 = stmt.executeQuery("select password from userdesc where password like '"+pass+"' and name like '"+name+"'");
0
 
KuldeepchaturvediCommented:
If you are doing a like... that I guess you need a % in there as well...


ResultSet rs1 = stmt.executeQuery("select password from userdesc where password like '"+pass+"%' and name like '"+name+"%'");
0
 
RonayneAuthor Commented:

Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.