Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String getTablaDir() throws SQLException {
- Connection con = DriverManager.getConnection("jdbc:mysql://localhost:33331","DAF", "DTI");
- Statement stmt = con.createStatement();
- StringBuilder sb = new StringBuilder();
- String sql;
- int contador = 0;
- sql = "SELECT * FROM dticomun.svtdir";
- ResultSet rs = stmt.executeQuery(sql);
- sb.append("<table id='tablaDirecciones' class='table tbPersonas table-bordered table-striped table-condensed'>"
- + "<thead>"
- + "<tr>"
- + "<th>"
- + "Codigo"
- + "</th>"
- + "<th>"
- + "Tipo Direccion"
- + "</th>"
- + "</tr>"
- + "</thead>"
- + "<tbody>");
- while (rs.next()) {
- if ((contador % 2) == 1) {
- sb.append("<tr data-toggle='collapse' data-target='#direccionAction" + rs.getInt("oid_tdir")
- + "' id='dir-" + rs.getInt("oid_tdir") + "' class='accordion-toggle zebra1 dir'>");
- } else {
- sb.append("<tr data-toggle='collapse' data-target='#direccionAction" + rs.getInt("oid_tdir")
- + "' id='dir-" + rs.getInt("oid_tdir") + "' class='accordion-toggle zebra0 dir'>");
- }
- sb.append("<td> " + rs.getString("cod_tdir") + "</td>"
- +"<td> " + rs.getString("tipo_direccion") + "</td>"
- +"</tr>");
- sb.append("<tr class='resultado'>");
- sb.append("<td colspan='9' class='hiddenRow'>");
- sb.append("<div class='accordion-body collapse' id='direccionAction" + rs.getInt("oid_tdir") + "'></div>");
- sb.append("</td></tr>");
- contador++;
- }
- sb.append("</tbody>"
- + "</table>");
- stmt.close();
- con.close();
- rs.close();
- return sb.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement