rs.close();出错
<%Connectioncon=null;Statementstmt=null;ResultSetrs=null;try{Class.forName("com.mysql...
<%
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/aa?useUnicode=true&characterEncoding=gbk";
con=DriverManager.getConnection(url,"root","");
stmt=con.createStatement();
request.setCharacterEncoding("UTF-8");
String shetuanname=request.getParameter("shetuanname");
String sql="select * from shetuan where shetuanname='"+shetuanname+"'";
rs=stmt.executeQuery(sql);
if(rs.next()){
request.setAttribute("id", rs.getInt("id"));
request.setAttribute("content", rs.getString("content"));
request.setAttribute("shetuanname", rs.getString("shetuanname"));
request.setAttribute("time", rs.getString("time"));
RequestDispatcher rd=request.getRequestDispatcher("update.jsp");
rd.forward(request, response);
}else{
out.println("没找到名字为"+shetuanname+"的记录");
}
}catch (SQLException e){
e.printStackTrace();
}finally{
try{
rs.close();
stmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
%>
这是关键代码,不知道哪里出了问题。rs.close();总执行不了 展开
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://localhost:3306/aa?useUnicode=true&characterEncoding=gbk";
con=DriverManager.getConnection(url,"root","");
stmt=con.createStatement();
request.setCharacterEncoding("UTF-8");
String shetuanname=request.getParameter("shetuanname");
String sql="select * from shetuan where shetuanname='"+shetuanname+"'";
rs=stmt.executeQuery(sql);
if(rs.next()){
request.setAttribute("id", rs.getInt("id"));
request.setAttribute("content", rs.getString("content"));
request.setAttribute("shetuanname", rs.getString("shetuanname"));
request.setAttribute("time", rs.getString("time"));
RequestDispatcher rd=request.getRequestDispatcher("update.jsp");
rd.forward(request, response);
}else{
out.println("没找到名字为"+shetuanname+"的记录");
}
}catch (SQLException e){
e.printStackTrace();
}finally{
try{
rs.close();
stmt.close();
con.close();
}catch (SQLException e){
e.printStackTrace();
}
}
%>
这是关键代码,不知道哪里出了问题。rs.close();总执行不了 展开
2个回答
2016-03-31
展开全部
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询