:<a href="delteacher1.jsp?id=No data found 求解决,谢谢!
问题:<a href="delteacher1.jsp?id=No data found 求解决,谢谢!delteacher.jsp:
<body>
<% Connection conn=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String strConn="jdbc:odbc:house";
String strUser="sa";
String strPassword="111111";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stm=conn.createStatement();
String strSql="SELECT teatherid,depart,name,sex,job,canjiagongzuoshijian,lizhishijian,workingage,zaizhiqingkuang,xianyouzhufangmianji,fenpeinianyuer,fenpeixianjin,shifoudabiao,dabiaomianjicae,remark FROM Info ";
ResultSet rs=stm.executeQuery(strSql);
%>
<center><h2>教师基本信息</h2></center>
<table border="1" align="center" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#c5d7ed">
<tr height="30">
<th>教师编号</th>
<th>教师部门</th>
<th>教师姓名</th>
<th>教师性别</th>
<th>教师职务</th>
<th>参加工作时间</th>
<th>离职时间</th>
<th>工 龄</th>
<th>在职情况</th>
<th>现有住房面积</th>
<th>分配年月日</th>
<th>分配现金</th>
<th>是否达标</th>
<th>达标面积差额</th>
<th>备 注</th>
<th> </th></tr>
<%while(rs.next()){%>
<tr height="30" bgcolor="#ffffff" align="center">
<td><%=rs.getString(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getString(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getString(5)%></td>
<td><%=rs.getString(6)%></td>
<td><%=rs.getString(7)%></td>
<td><%=rs.getDouble(8)%></td>
<td><%=rs.getString(9)%></td>
<td><%=rs.getDouble(10)%></td>
<td><%=rs.getString(11)%></td>
<td><%=rs.getDouble(12)%></td>
<td><%=rs.getString(13)%></td>
<td><%=rs.getDouble(14)%></td>
<td><%=rs.getString(15)%></td>
<td><a href="delteacher1.jsp?id=<%=rs.getString(1)%>">删除</a></td></tr>
<%}%>
<% rs.close();
stm.close();
conn.close();
}catch(ClassNotFoundException e){
out.println(e.getMessage());
}catch(SQLException e){
out.println(e.getMessage());}
%>
</body>
</html>
delteacher1.jsp:
<body>
<% Connection conn=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String strConn="jdbc:odbc:house";
String strUser="sa";
String strPassword="111111";
conn=DriverManager.getConnection(strConn,strUser,strPassword);
Statement stm=conn.createStatement();
String id="";
id=request.getParameter("id");
String sql3="delete from Info where teatherid='"+id+"'";
int n=stm.executeUpdate(sql3);
if(n>0){
out.println("<script Language='JavaScript'>window.alert('删除成功,即将返回浏览员工档案信息页面!')</script>");
out.println("<script Language='JavaScript'>window.location='delteacher.jsp'</script>");
}else{
out.println("<script Language='JavaScript'>window.alert('删除失败,即将返回浏览员工档案信息页面!')</script>");
out.println("<script Language='JavaScript'>window.location='delteacher.jsp'</script>");
}
%>
<%
stm.close();
conn.close();
}catch(ClassNotFoundException e){
out.println(e.getMessage());
}catch(SQLException e){
out.println(e.getMessage());}
%>
</body>
</html>