コード例 #1
0
 String getValue(java.sql.ResultSet rs, String strFieldName) {
   if ((rs == null) || (isEmpty(strFieldName)) || ("".equals(strFieldName))) return "";
   try {
     String sValue = rs.getString(strFieldName);
     if (sValue == null) sValue = "";
     return sValue;
   } catch (Exception e) {
     return "";
   }
 }
コード例 #2
0
 String getValueHTML(java.sql.ResultSet rs, String fieldName) {
   try {
     String value = rs.getString(fieldName);
     if (value != null) {
       return toHTML(value);
     }
   } catch (java.sql.SQLException sqle) {
   }
   return "";
 }
コード例 #3
0
  String getOptions(
      java.sql.Connection conn,
      String sql,
      boolean isSearch,
      boolean isRequired,
      String selectedValue) {

    String sOptions = "";
    String sSel = "";

    if (isSearch) {
      sOptions += "<option value=\"\">All</option>";
    } else {
      if (!isRequired) {
        sOptions += "<option value=\"\"></option>";
      }
    }
    try {
      java.sql.Statement stat = conn.createStatement();
      java.sql.ResultSet rs = null;
      rs = openrs(stat, sql);
      while (rs.next()) {
        String id = toHTML(rs.getString(1));
        String val = toHTML(rs.getString(2));
        if (id.compareTo(selectedValue) == 0) {
          sSel = "SELECTED";
        } else {
          sSel = "";
        }
        sOptions += "<option value=\"" + id + "\" " + sSel + ">" + val + "</option>";
      }
      rs.close();
      stat.close();
    } catch (Exception e) {
    }
    return sOptions;
  }
コード例 #4
0
 String dLookUp(java.sql.Statement stat, String table, String fName, String where) {
   java.sql.Connection conn1 = null;
   java.sql.Statement stat1 = null;
   try {
     conn1 = cn();
     stat1 = conn1.createStatement();
     java.sql.ResultSet rsLookUp =
         openrs(stat1, "SELECT " + fName + " FROM " + table + " WHERE " + where);
     if (!rsLookUp.next()) {
       rsLookUp.close();
       stat1.close();
       conn1.close();
       return "";
     }
     String res = rsLookUp.getString(1);
     rsLookUp.close();
     stat1.close();
     conn1.close();
     return (res == null ? "" : res);
   } catch (Exception e) {
     return "";
   }
 }