Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//2得到连接
Connection ct=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=ls","sa","123");
//3创建Statement
Statement sm=ct.createStatement();
//4查询
ResultSet rs=sm.executeQuery("select count(*) from login");
while(rs.next())
{
rowCount=rs.getInt(1);
}
if(rowCount%pageSize==0)
{
pageCount=rowCount/pageSize;
}else
{
pageCount=rowCount/pageSize+1;
}
//查询出显示的记录
rs=sm.executeQuery("select top "+pageSize+" * from login where userId not in(select top "+pageSize*(pageNow-1)+" userId from login)");
%>
用户Id | 用户名 | 用户密码 | 操作 |
<%
while(rs.next())
{
%>
<%=rs.getString(1) %> | <%=rs.getString(2) %> | <%=rs.getString(3) %> | 修改|删除 |
<%
}
%>