get Long Value From ResultSet - Java java.sql

Java examples for java.sql:ResultSet

Description

get Long Value From ResultSet

Demo Code


//package com.java2s;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static Long getLongValueFromRs(ResultSet rs, String columnName) {
        Long val = null;
        try {/*from w  w w  . ja va  2s  . co  m*/
            if (rs.getString(columnName) != null) {
                val = new Long(rs.getLong(columnName));
            }
        } catch (SQLException sqle) {
            val = null;
        }
        return val;
    }
}

Related Tutorials