<% @ Page ContentType = "Text / HTML; Charset = GB2312" Language = "Java" Import = "java.sql. *" ErrorPage = ""%>
No title document
<% @ Page ContentType = "text / html; charset = GB2312" Language = "java" import = "java.sql. *"%>
<% @ include file = "conn.jsp"%>
<%
Class.Forname ("com.microsoft.jdbc.sqlser.sqlserverdriver);
String URL = "JDBC: Microsoft: SQLServer: // localhost: 1433; DatabaseName = Guestbook";
Connection Con = DriverManager.getConnection (URL, "SA", "Szwen");
Statement Stmt = con.createstatement (ResultSet.Type_Scroll_insensitive,
ResultSet.concur_read_only);
INT INTPAGECUNT; / / Total number of pages
INT INTROWCOUNT; / / Total record
INT INTPAGESIZE; / / Each page shows the number of records
int INTPAGE; // Current page
INT INTNEXT; / / Next
INT INTPREV; // Previous
INT I;
String strpage;
StrPage = Request.getParameter ("Page");
IF (strpage == null) {INTPAGE = 1;} else {INTPAGE = integer.parseint (strpage);
String SQL = "SELECT * from addressbook_table";
ResultSet RS = Stmt.executeQuery (SQL);
Rs.last ();
introwcount = rs.getrow ();
INTPAGESIZE = 5;
INTPAGECOUNT = (Introwcount INTPAGESIZE-1) / INTPAGESIZE
IF (INTPAGE) {INTPAGE = INTPAGECUNT;
IF (Introwcount IF (INTPAGE <0) {INTPAGE = 1; i = 0; IF (Introwcount> 0) { Rs.absolute (INTPAGE-1) * INTPAGESIZE 1); While (i Out.print (Rs.getstring ("Phone") "" Out.print (Rs.getstring ("Address") "" " Out.print (Rs.getstring ("name") " i ; } Rs.close (); Stmt.close (); } INTNEXT = INTPAGE 1; IF (intNext> INTPAGECOUNT) {inTnext = INTPAGECUNT; INTPREV = INTPAGE -1; IF (INTPREV <1) {INTPREV = 1; %> <% = INTROUNT%> Record a total of <% = INTPAGECOUNT%> Page <% = INTPAGESIZE%> strip record <% = INTPAGESIZE%> strip INTPREV
"); rs.next ();