I already have my query done, only instead of showing me the data horizontally, I would like it to show it vertically. I'm doing it in NetBeans in a Java Web Application .
Code:
<div class="container">
<thead>
<center><table class="table" border="1">
<tr class="success">
<%
consulta conexion = new consulta (
"jdbc:oracle:thin:@localhost:1521:XE","pasaportes","oppasaportes"
);
String consulta = "SELECT * FROM delegaciones WHERE id_delegacion ='1'";
ResultSet rs = conexion.ejeSelect(consulta);
ResultSetMetaData rsmd = rs.getMetaData();
int col= rsmd.getColumnCount();
for(int k=1;k<=col;k++){
%>
<td><h4> <%= rsmd.getColumnName(k) %></h4></td>
<%
}
%>
</tr>
<%
while(rs.next()){
%>
<tr class="info">
<td><h4><%= rs.getString(1) %></h4> </td>
<td><h4><%= rs.getString(2) %></h4> </td>
<td><h4><%= rs.getString(3) %></h4> </td>
<td><h4><%= rs.getString(4) %></h4> </td>
<td><h4><%= rs.getString(5) %></h4> </td>
<td><h4><%= rs.getString(6) %></h4> </td>
<td><h4><%= rs.getString(7) %></h4> </td>
</tr>
<%
}
%>
</table></center>
</thead>
</div>
Looking at your query, you're getting a single result row, and you want to display it as a column.
In that case you can do:
To get the table in the form column name - value