If you've typed it's ok and var info1 it's String type
your select order should be like:
ResultSet rs = stmt.executeQuery ("SELECT * FROM sample1 WHERE ename = '"+
info1 +"';");
note the simple quote before equal and before semicolon in order to make the
sentence equals to original (I think that semicolon it's unnecessary too).

-----Mensaje original-----
De: mahesh <[EMAIL PROTECTED]>
Para: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Fecha: martes 23 de febrero de 1999 11:35
Asunto: servlet & JDBC


    Hi
    I am getting runtime error while executing an sql query using variable
name with WHERE clause. But if i am using some  value instead of var name it
is working and fetching data from database.
    here is the code.
    ResultSet rs = stmt.executeQuery ("SELECT * FROM sample1 WHERE ename =
'mahesh' ");
    this is working but
    ResultSet rs = stmt.executeQuery ("SELECT * FROM sample1 WHERE ename =
"+ info1 +";");
    it is giving java131 runtime error. where info1 =
request.getParameter("acct"); acct is the name of the text field.

    please point out the fault in it...
    thanks in advance
    regards
    Mahesh

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to