JSP查询数据库

MyJsp
<% Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; String sql = "slecte * from users";
conn= DBUtil.getConn();
try {
ps = conn.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){
%>
<%=rs.getInt("id")%> <%=rs.getString("name")%> <%=rs.getInt("age")%> <%=rs.getString("user_name")%> <%=rs.getString("pwd")%> <% } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } DBUtil.close(conn, ps, rs); %>

相关文章:
-
2021-12-07
-
2021-08-06
-
2021-08-07
-
2021-08-15
-
2021-08-28
-
2021-08-28
-
2021-09-29
-
2021-11-13