Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jsp/mysql syntax

Posted on 2004-04-07
4
Medium Priority
?
294 Views
Last Modified: 2010-04-01

 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+"\"");
0
Comment
Question by:Ronayne
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Nick_72 earned 200 total points
ID: 10775428
Hello,

try this:

ResultSet rs1 = stmt.executeQuery("select password from userdesc where password like \""+pass+"\" and name like \""+name+"\"");
0
 
LVL 9

Expert Comment

by:Nick_72
ID: 10775440
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
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10775642
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
 

Author Comment

by:Ronayne
ID: 10775651

Thank you
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Did you know there are services out there that can turn an Instagram feed into an RSS feed? I found some interesting exclusive Instagram content which I wanted to follow without signing up for yet another social media account. RSS to the rescue!
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question