Java examples for java.sql:ResultSet
get Single Result from ResultSet
//package com.java2s; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static Integer getSingleResult(PreparedStatement ps) throws SQLException { Integer retval;/*from w ww . j a va2s. c o m*/ ResultSet rs = ps.executeQuery(); if (rs.next()) retval = rs.getInt(1); else retval = null; rs.close(); return retval; } }