【发布时间】:2010-10-08 18:45:03
【问题描述】:
根据用户的输入,我想从数据库中选择记录。这是我的代码:
<%
String jempid=request.getParameter("empid");
out.println(jempid);
int intempid=1223;
Connection conn=null;
String url="jdbc:mysql://localhost/employees";
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection(url,"root","");
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from empdetails where empnum=jempid");
%>
它会抛出以下错误
javax.servlet.ServletException: java.sql.SQLException: 'where 子句中的未知列'jempid'
【问题讨论】:
-
嘿嘿..没有代码是完美的代码。