根據用戶的輸入我想從數據庫中選擇記錄。這是我的代碼:如何在網頁中使用where子句時輸入條目?
<%
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:未知列 'jempid' 在「where子句
他他..沒有代碼是完美的代碼。 – Learning 2009-02-20 05:59:28
在那裏,修正了這個問題。 – paxdiablo 2009-02-20 06:00:39
不能得到你的朋友.. – user67722 2009-02-20 06:02:36