Code example for ResultSet

Methods: getString, next

0
		DBUtil util=new DBUtil();
		Connection conn=util.openConnection();
		try { 
			PreparedStatement pstmt = conn.prepareStatement(sql);
			ResultSet rs=pstmt.executeQuery();			
			if(rs.next()){
				out.print(rs.getString("id")+"/");
				out.print(rs.getString("username")+"/");
				out.print(rs.getString("password")+"/");
				out.print(rs.getString("truename"));
			} 
		} catch (SQLException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} 
	} 
 
	/** 
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
	 */ 
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {