dcsimg
can i include variable names in a query?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   richard_asiimwe
Posted On:   Sunday, July 25, 2004 08:29 AM

hello i need to pick data (usernames and passwords)from a normal html form and then query the database from inside a servlet to return the password stored in userDetails table for the submitted username after which i compare the two and allow or deny login. The problem if i store the submitted user name in a variable String uname = username.getSstring(); can i write the query as say select passwd from userDetails where UserID = uname remember uname is not the actual value, but just a variable storing the actual username. thanks alot. any help is really appreciated. richard.    More>>


hello


i need to pick data (usernames and passwords)from a normal html form and then query the database from inside a servlet to return the password stored in userDetails table for the submitted username after which i compare the two and allow or deny login.


The problem


if i store the submitted user name in a variable

String uname = username.getSstring();

can i write the query as say

select passwd from userDetails where UserID = uname

remember uname is not the actual value, but just a variable storing the actual username.

thanks alot. any help is really appreciated.

richard.    <<Less

Re: can i include variable names in a query?

Posted By:   David_Thornton  
Posted On:   Sunday, July 25, 2004 06:06 PM

Have a read of Using Prepared Statements in the Sun Java Tutorial.
About | Sitemap | Contact