aspose file tools*
The moose likes JDBC and the fly likes Getparameter and then display a record--how? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getparameter and then display a record--how?" Watch "Getparameter and then display a record--how?" New topic
Author

Getparameter and then display a record--how?

Raja Sagar Panamgipalli
Ranch Hand

Joined: Aug 13, 2003
Posts: 109
Hi Guys,

I'm kinda new to JDBC ...i haven't been able to resolve this problem ..ie..

Consider a html page that takes an employee name ...which through
form method =get action= \servletJdbcVlidation post the parameter to the servlet.
There in the servlet i have the code like follows...


stmt.executeQuery("select passwd from employee where username like"+ vart);
how do i give the String stored in vart to the SQL statement...i dont get the trick in giving the syntax.
plz help.........
thankyou
regards
Sagar


SCJP 1.4<br />SCBCD 1.3
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Sagar,
To do an exact match, you need single quotes around the parameter.

Is the user passing in the wildcards in the like clause? If not, you may want to do:

That will return any matches containing the parameter, not just exact matches.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getparameter and then display a record--how?