可重用的sql操作类
1 public ResultSet doQuery(String sql,Object[] params){ 2 ResultSet rs = null; 3 conn = this.getConnection(); 4 try{ 5 PreparedStatement pstmt = conn.prepareStatement(sql); 6 for(int i =0;i
1 public int doUpdate(String sql,Object[] params){ 2 int res = 0; 3 conn = this.getConnection(); 4 try{ 5 PreparedStatement pstmt = conn.prepareStatement(sql); 6 for(int i=0;i
1 public List
查询所有信息的jsp关键代码如下
1 <% 2 DBCon dbc = new DBCon(); 3 String sql = "select * from schema.admin"; 4 List list = dbc.doQueryList(sql, new Object[]{}); 5 6 %> 7map = (Map )list.get(i);10 %>11
<%=map.get("id") %> | 13<%=map.get("username") %> | 14<%=map.get("password") %> | 15">删除 | 16">编辑 | 17
更新、删除登操作同理,不再列出。