Solved

jsp/mysql syntax

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now