1 Replies - 308 Views - Last Post: 27 October 2018 - 06:24 PM

#1 sonar87   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 79
  • Joined: 04-February 08

JSP Reading unknown number of rows/columns of DB table.

Posted 27 October 2018 - 08:37 AM

I have seen examples that show me how to get for any number of rows/entries like this:

conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("SELECT * FROM Country");

    [b]while(rs.next())[/b] {
%>
    <h3>Name: <%= rs.getString("Name") %></h3>
    <h3>Population: <%= rs.getString("Population") %></h3>
<%  
    }
  }


But how shall do the read in if I do not know all the columns and their names? For general use while loop/function for any table?

How would you even get just number of columns and number of rows?

Is This A Good Question/Topic? 0
  • +

Replies To: JSP Reading unknown number of rows/columns of DB table.

#2 sonar87   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 79
  • Joined: 04-February 08

Re: JSP Reading unknown number of rows/columns of DB table.

Posted 27 October 2018 - 06:24 PM

Also what are JSP equivalent of $error = mysqli_error(); and $query_html = htmlspecialchars(query); from PHP?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1