Java SQL ResultSet Read getNumber(ResultSet rs, String name)

Here you can find the source of getNumber(ResultSet rs, String name)

Description

get Number

License

Open Source License

Declaration

public static String getNumber(ResultSet rs, String name) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static String getNumber(ResultSet rs, String name) {
        try {//  w w  w.  ja  va 2 s. c om
            return "\"" + name + "\":" + rs.getLong(name) + "";
        } catch (SQLException ex) {
            return "\"" + name + "\":\"error\"";
        }
    }
}

Related

  1. getNullableBooleanFromResultSet(ResultSet rset, Enum field)
  2. getNullableByte(ResultSet resultSet, String columnLabel)
  3. getNullableInt(ResultSet resultSet, String column, int fallback)
  4. getNullableLong(ResultSet rs, String columnName)
  5. getNullDate(ResultSet result, String columnName)
  6. getNumberColumns(ResultSet rs)
  7. getNumRows(ResultSet query)
  8. getObject(ResultSet resultSet, int columnCount, Map columnLabelMap, String[] fields, String[] columnLabel, Class cls, Boolean flag)
  9. getObject(ResultSet rs, int columnIndex, Class type)