Solved

jsp/mysql syntax

Posted on 2004-04-07
4
289 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 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How To Remove a Principal from HttpServletRequest 4 51
Retrieving file from bytes array in spring mvc 8 62
Books that can get me started on JAVA 2 105
tomcat startup error 5 101
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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