|
 |
pro_jsp thread: Resultset scrolling.
Message #1 by "Al Higgs" <al.higgs@b...> on Mon, 11 Mar 2002 21:16:48
|
|
Hi Liselotte,
you should really look at: www.jsptags.com
There's a tag-library with nice examples for this.
Hth, Peter
Liselotte Hjelmbjerg wrote:
> Try this instead:
> <%
> ResultSetMetaData rsmd = null;
> int numColumns;
> int rows;
>
> ResultSet rst=s.executeQuery(sql);
> rsmd = rst.getMetaData();
> numColumns = rsmd.getColumnCount();
>
>
> while (rst.next())
> {
> for(int com =1; col<=numColumns; col++)
> { rows++; }
> }
> %>
> <%=rows%>
> I dont know if the JSP tags are placed correctly!!
>
> > Hello,
> >
> > Im probably asking fo too much help here, but can anyone tell me how to
> > scroll through a resultset.
> >
> > Ive set the connection up to allow scrolling, but thats as far as ive
> got.
> >
> > If anyone can help, or point me in the right direction of a tutorial i
> > would be very grateful...
> >
> > <%
> > // Setup the sql String To retreive the data from the database
> > String sql="SELECT * FROM cottages order by "+orderby+" ASC";
> >
> > // Connect To the Access database using a bridge driver
> > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> > Connection con=DriverManager.getConnection("jdbc:odbc:higgsa");
> > Statement s=con.createStatement
> > (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
> > // Create recordset
> > ResultSet rst=s.executeQuery(sql);
> >
> >
> > // While there Is data In the resultset...
> > while (rst.next())
> > {
> > out.print("All the information here");
> > }
> >
> > // Then display the table to scroll through the resultset
> > out.print("<a href=>");
> > out.print("Next 10 Matches >>");
> > out.print("</a>");
> >
> > // Then Close the resultset
> > rst.close();
> > con.close();
> > %>
> >
> > Thanks
> >
> > Al
|
|
 |