Try this... Where you see "\'" it really is
" \ ' " without any spaces. I say that because it is hard to
see
that there is a single quote after the backslash.
ResultSet rs = stmt.executeQuery
("SELECT * FROM sample1 WHERE ename = " + "\'" + info1 +
"\'");
-----Original Message-----
From: mahesh <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, February 23, 1999 5:56 AM
Subject: servlet & JDBCHiI 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 butResultSet 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 advanceregardsMahesh
