老是出错,数据读取出错!
问题描述:
假如在上一个页面传来一个参数:
请输入年级:<input type="text" name="check" id="check" >
在当前页面读取:
<table>
<%
//数据库已经连接
String check =request.getParameter("check");
String sql="select count(*) as total from students where grade="+check;
rs =smt.executeQuery(sql);
while(rs.next()){%>
<tr>
<td>
<%=rs.getString("total")%>
</td>
</tr>
</table>
<%}
conn.close();
rs.close();
smt.close();
%>
老是出错,请高手指教,加分!
假如在上一个页面传来一个参数:
请输入年级:<input type="text" name="check" id="check" >
在当前页面读取:
<table>
<%
//数据库已经连接
String check =request.getParameter("check");
String sql="select count(*) as total from students where grade="+check;
rs =smt.executeQuery(sql);
while(rs.next()){%>
<tr>
<td>
<%=rs.getString("total")%>
</td>
</tr>
</table>
<%}
conn.close();
rs.close();
smt.close();
%>
老是出错,请高手指教,加分!
...全文


