get Byte Value From ResultSet - Java java.sql

Java examples for java.sql:ResultSet

Description

get Byte Value From ResultSet

Demo Code


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

public class Main {
    public static Byte getByteValueFromRs(ResultSet rs, String columnName) {
        Byte val = null;
        try {//from   ww  w.  jav  a 2 s  .c  o m
            if (rs.getString(columnName) != null) {
                val = new Byte(rs.getByte(columnName));
            }
        } catch (SQLException sqle) {
            val = null;
        }
        return val;
    }
}

Related Tutorials