Java examples for java.sql:ResultSet
get Single Result String from PreparedStatement
//package com.java2s; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static String getSingleResultString(PreparedStatement ps) throws SQLException { String retval;/* ww w . ja va2 s . c o m*/ ResultSet rs = ps.executeQuery(); if (rs.next()) retval = rs.getString(1); else retval = null; rs.close(); return retval; } }