ITeye博客

删除传来的相应用户ID

ningzai · 2008-12-17 01:46 · 技术代码 · Markdown

<%//接受用户ID long id; try{ id=Long.parseLong(request.getParameter("id")); }catch (Exception e) { id=0; } %> <%//构造删除记录SQL语句 String sqlString=null; if(id!=0){ sqlString="delete from usertable where id="+id; try{ Connection con; Statement sql; Class.forName("com.mysql.jdbc.Driver");//加载数据库驱动程序; con=DriverManager.getConnection("jdbc:mysql://localhost:3306/jsp","root","7056503"); sql=con.createStatement(); sql.executeUpdate(sqlString); con.close();

}
catch(SQLException e){
 out.print("SQL异常!");
}

}

%>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。